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