68 lines
1.1 KiB
C++
68 lines
1.1 KiB
C++
|
|
#include <Wire.h>
|
|
#include "WiFlyUDP.h"
|
|
|
|
#define ADDRESS 0x61 // The address of the SD21
|
|
#define SERVO 0x3F // Address of first servo
|
|
|
|
char *ssid = "FORESTALPALOME";
|
|
char *pass = "laura";
|
|
|
|
uint16_t remote_Port=8000;
|
|
uint16_t local_Port=9000;
|
|
char* ip_host = "172.26.0.46";
|
|
|
|
WiFlyUDP udp(&Serial);
|
|
|
|
int count = 0;
|
|
int inByte;
|
|
|
|
|
|
void setup(){
|
|
|
|
Wire.begin();
|
|
pinMode(2, OUTPUT);
|
|
digitalWrite(2, HIGH);
|
|
|
|
Serial.begin(9600);
|
|
|
|
udp.begin(ssid, pass, ip_host, remote_Port, local_Port);
|
|
|
|
if (udp.join())
|
|
{
|
|
delay(4000);
|
|
digitalWrite(2, LOW);
|
|
Serial.print(udp.ip());
|
|
}
|
|
|
|
}
|
|
|
|
void loop(){
|
|
|
|
//Serial.print("Hola mundo!");
|
|
//Serial.println(count++);
|
|
//delay(100);
|
|
|
|
if (Serial.available() > 0) {
|
|
// get incoming byte:
|
|
inByte = Serial.read();
|
|
Serial.print(inByte);
|
|
/*
|
|
Wire.beginTransmission(ADDRESS);
|
|
Wire.write(SERVO);
|
|
Wire.write(inByte); // Send a value of 255 to servo 1
|
|
Wire.endTransmission();
|
|
|
|
digitalWrite(2, LOW);
|
|
delay(10);
|
|
digitalWrite(2, HIGH);
|
|
delay(10);
|
|
*/
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|