Lysregulering
/
TESTDIOPOT
edqw
Fork of TESTSENDIO by
main.cpp@1:d752dab97a81, 2018-02-16 (annotated)
- Committer:
- andreasbirkeland97
- Date:
- Fri Feb 16 17:09:39 2018 +0000
- Revision:
- 1:d752dab97a81
- Parent:
- 0:8142893960b0
zdv
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andreasbirkeland97 | 0:8142893960b0 | 1 | #include "XBeeLib.h" |
andreasbirkeland97 | 1:d752dab97a81 | 2 | #include "mbed.h" |
andreasbirkeland97 | 1:d752dab97a81 | 3 | |
andreasbirkeland97 | 1:d752dab97a81 | 4 | AnalogIn ai(p20); |
andreasbirkeland97 | 1:d752dab97a81 | 5 | Serial pc(USBTX, USBRX); |
andreasbirkeland97 | 0:8142893960b0 | 6 | |
andreasbirkeland97 | 0:8142893960b0 | 7 | using namespace XBeeLib; |
andreasbirkeland97 | 0:8142893960b0 | 8 | |
andreasbirkeland97 | 0:8142893960b0 | 9 | int main() |
andreasbirkeland97 | 0:8142893960b0 | 10 | { |
andreasbirkeland97 | 1:d752dab97a81 | 11 | XBeeZB xbee = XBeeZB(RADIO_TX, RADIO_RX, RADIO_RESET); |
andreasbirkeland97 | 1:d752dab97a81 | 12 | RadioStatus radioStatus; |
andreasbirkeland97 | 1:d752dab97a81 | 13 | float voltage; |
andreasbirkeland97 | 0:8142893960b0 | 14 | while(1){ |
andreasbirkeland97 | 0:8142893960b0 | 15 | RemoteXBeeZB remoteDevice = RemoteXBeeZB(0x0013A20041642F34); |
andreasbirkeland97 | 1:d752dab97a81 | 16 | voltage = ai * 16; |
andreasbirkeland97 | 1:d752dab97a81 | 17 | if(voltage > 2){ |
andreasbirkeland97 | 1:d752dab97a81 | 18 | radioStatus = xbee.set_pin_config(remoteDevice, XBeeZB::DIO4, DigitalOutHigh); |
andreasbirkeland97 | 1:d752dab97a81 | 19 | pc.printf("LYS"); |
andreasbirkeland97 | 1:d752dab97a81 | 20 | } |
andreasbirkeland97 | 1:d752dab97a81 | 21 | else { |
andreasbirkeland97 | 1:d752dab97a81 | 22 | radioStatus = xbee.set_pin_config(remoteDevice, XBeeZB::DIO4, DigitalOutLow); |
andreasbirkeland97 | 1:d752dab97a81 | 23 | pc.printf("IKKE LYS");} |
andreasbirkeland97 | 1:d752dab97a81 | 24 | |
andreasbirkeland97 | 0:8142893960b0 | 25 | } |
andreasbirkeland97 | 1:d752dab97a81 | 26 | } |