Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created October 7, 2015 09:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuc-arc-f/1dfdcf950ade49436ce5 to your computer and use it in GitHub Desktop.
Save kuc-arc-f/1dfdcf950ade49436ce5 to your computer and use it in GitHub Desktop.
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