edqw

Dependencies:   XBeeLib mbed

Fork of TESTSENDIO by Lysregulering

main.cpp

Committer:
andreasbirkeland97
Date:
2018-02-16
Revision:
1:d752dab97a81
Parent:
0:8142893960b0

File content as of revision 1:d752dab97a81:

#include "XBeeLib.h"
#include "mbed.h"

AnalogIn ai(p20);
Serial pc(USBTX, USBRX);
  
using namespace XBeeLib;
 
int main()
{
XBeeZB xbee = XBeeZB(RADIO_TX, RADIO_RX, RADIO_RESET);
RadioStatus radioStatus;
float voltage;
 while(1){
    RemoteXBeeZB remoteDevice = RemoteXBeeZB(0x0013A20041642F34);
    voltage = ai * 16;
    if(voltage > 2){
            radioStatus = xbee.set_pin_config(remoteDevice, XBeeZB::DIO4, DigitalOutHigh);
            pc.printf("LYS");
        }
        else {
            radioStatus = xbee.set_pin_config(remoteDevice, XBeeZB::DIO4, DigitalOutLow);
            pc.printf("IKKE LYS");}

}
}