|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
|
|
|
|
|
RH_ASK driver(2000);
|
|
|
|
|
|
|
|
|
|
int lastval[] = {0,0,0};
|
|
|
|
|
uint8_t lastval[] = {0,0,0};
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
|
{
|
|
|
|
@ -14,17 +14,17 @@ void setup()
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
for(int i=0; i < 3; i++){
|
|
|
|
|
int val = analogRead(i)/4;
|
|
|
|
|
for(uint8_t i = 0; i < 3; i++) {
|
|
|
|
|
uint8_t val = (uint8_t)analogRead(i)/4;
|
|
|
|
|
|
|
|
|
|
if(val >= lastval[i]+3 || val <= lastval[i]-3){
|
|
|
|
|
char msg[4];
|
|
|
|
|
lastval[i] = val;
|
|
|
|
|
sprintf(msg, "%d%d", val, i);
|
|
|
|
|
uint8_t msg[2] = { val, i };
|
|
|
|
|
|
|
|
|
|
Serial.println(msg);
|
|
|
|
|
driver.send((uint8_t *)msg, 4);
|
|
|
|
|
driver.send((uint8_t *)msg, 2);
|
|
|
|
|
driver.waitPacketSent();
|
|
|
|
|
|
|
|
|
|
lastval[i] = val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|