Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ATtiny85 send to esp8266, AT command data (Serial)
/*
attiny85_to_esp8266_at.ino
ATtiny85 send to esp8266(AT), SoftwareSerial data
[ Arduino SDK 1.0.5 ]
PIN : D3=RX, D4=TX, A1=Analog Input
AT+CIPSEND : Input required, HTTP data Length (manual count)
*/
#include <SoftwareSerial.h>
int mNextTime=30;
SoftwareSerial mySerial(3, 4); // RX, TX
//
void setup() {
mySerial.begin( 9600 );
pinMode(1 ,INPUT);
}
//
void loop() {
delay( (mNextTime-4) * 1000);
mySerial.print("AT+CIPSTART=\"TCP\",\"your-dns.com\",80\r\n");
delay(3 * 1000);
int iSen1 =analogRead(1);
iSen1=iSen1+10000; //add 10,000
mySerial.print("AT+CIPSEND=9999\r\n");
delay(1000);
mySerial.print("GET /api1234.php?snum_1=");
mySerial.print( iSen1 );
mySerial.print(" HTTP/1.0\r\n");
mySerial.print("Host: your-dns.com\r\n\r\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.