Étape 13 : Récepteur Arduino Software
#include < VirtualWire.h >
int [email protected] ;
int nem ;
int i ;
char x ;
char StringReceived [6] ;
void setup() {Serial.begin(115200) ;
vw_set_rx_pin(11) ; vw_setup(2400) ;
vw_rx_start() ;
}
void loop()
{
if(Serial.available() > 0)
x=Serial.Read() ;
uint8_t buf [VW_MAX_MESSAGE_LEN] ;
uint8_t buflen = VW_MAX_MESSAGE_LEN ;
if(x=='1′)
{
Si (vw_get_message (buf, & buflen))
{
pour (i = 0; i < buflen; i ++)
{
StringReceived [i] = char(buf[i]) ;
}
sscanf (StringReceived, « %d, %d », & [email protected], & nem) ;
Serial.println(sicaklik) ;
Delay(500) ;
Serial.println(NEM) ;
Delay(500) ;
memset (StringReceived, 0, sizeof (StringReceived)) ;
}
}
}