Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TESTSENDIO by
Revision 1:d752dab97a81, committed 2018-02-16
- Comitter:
- andreasbirkeland97
- Date:
- Fri Feb 16 17:09:39 2018 +0000
- Parent:
- 0:8142893960b0
- Commit message:
- zdv
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8142893960b0 -r d752dab97a81 main.cpp --- a/main.cpp Fri Feb 16 12:52:47 2018 +0000 +++ b/main.cpp Fri Feb 16 17:09:39 2018 +0000 @@ -1,18 +1,26 @@ #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; - - +XBeeZB xbee = XBeeZB(RADIO_TX, RADIO_RX, RADIO_RESET); +RadioStatus radioStatus; +float voltage; while(1){ RemoteXBeeZB remoteDevice = RemoteXBeeZB(0x0013A20041642F34); - radioStatus = xbee.set_pin_config(remoteDevice, XBeeZB::DIO4, DigitalOutHigh); - wait(0.01); - radioStatus = xbee.set_pin_config(remoteDevice, XBeeZB::DIO4, DigitalOutLow); - wait(0.01); + 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");} + } -} \ No newline at end of file +}