APRS ARDUINO wysyłanie stałej pozycji |
Masz tutaj zaczątek resztę dasz rade sam dopisać jest to prymitywne rozwiązanie .... opiera się na telnecie więc to samo możesz wykorzystać w ESP , ten przykład działa na W5100 #include <SPI.h> #include <Ethernet.h> // Enter a MAC address and IP address for your controller below. // The IP address will be dependent on your local network: byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 1, 177); IPAddress gateway(192, 168, 1, 1); IPAddress subnet(255, 255, 255, 0); // Enter the IP address of the server you're connecting to: IPAddress server(46, 21, 223, 230); //IPAddress server(192, 168, 137, 1); //char server[] = "poland.aprs2.net"; // Initialize the Ethernet client library // with the IP address and port of the server // that you want to connect to (port 23 is default for telnet; // if you're using Processing's ChatServer, use port 10002): EthernetClient client; void setup() { pinMode(31, OUTPUT); digitalWrite(31, LOW); pinMode(30, OUTPUT); digitalWrite(30, LOW); delay(1000); digitalWrite(31, HIGH); digitalWrite(30, HIGH); // start the Ethernet connection: Ethernet.begin(mac, ip); // Open serial communications and wait for port to open: Serial.begin(38400); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } // give the Ethernet shield a second to initialize: delay(5000); Serial.println("connecting..."); // if you get a connection, report back via serial: if (client.connect(server, 14580)) { Serial.println("connected"); delay(5000); client.println("user sq3fyk-9 pass xxxxx vers Arduino ETH filter p/SP3/SQ3/SR3"); xxxxxx pass do aprs-is Serial.println("Login send.."); } else { // if you didn't get a connection to the server: Serial.println("connection failed"); } } void loop() { { // if there are incoming bytes available // from the server, read them and print them: if (client.available()) { digitalWrite(30, LOW); char c = client.read(); Serial.print(c); digitalWrite(30, HIGH); } } // as long as there are bytes in the serial queue, // read them and send them out the socket if it's open: while (Serial.available() > 0) { char inChar = Serial.read(); if (client.connected()) { client.print(inChar); } } // if the server's disconnected, stop the client: if (!client.connected()) { Serial.println(); Serial.println("disconnecting."); client.stop(); // do nothing: while (true); } } //} |