Test arduino code
Fork of ArduinoHAL by
Arduino.c@4:40396527a068, 2011-06-04 (annotated)
- Committer:
- rbohne
- Date:
- Sat Jun 04 20:16:04 2011 +0000
- Revision:
- 4:40396527a068
- Parent:
- 0:a4ee09d0d765
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rbohne | 0:a4ee09d0d765 | 1 | #include "Arduino.h" |
rbohne | 0:a4ee09d0d765 | 2 | #include "mbed.h" |
rbohne | 0:a4ee09d0d765 | 3 | |
rbohne | 0:a4ee09d0d765 | 4 | |
rbohne | 0:a4ee09d0d765 | 5 | |
rbohne | 0:a4ee09d0d765 | 6 | static DigitalInOut allpins[] = {LED1, LED2, LED3, LED4, NC, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30}; |
rbohne | 0:a4ee09d0d765 | 7 | |
rbohne | 0:a4ee09d0d765 | 8 | void digitalWrite(int pin, int value) |
rbohne | 0:a4ee09d0d765 | 9 | { |
rbohne | 0:a4ee09d0d765 | 10 | //allpins[pin].output(); |
rbohne | 0:a4ee09d0d765 | 11 | allpins[pin].write(value); |
rbohne | 0:a4ee09d0d765 | 12 | } |
rbohne | 0:a4ee09d0d765 | 13 | |
rbohne | 0:a4ee09d0d765 | 14 | void pinMode(int pin, int mode) |
rbohne | 0:a4ee09d0d765 | 15 | { |
rbohne | 0:a4ee09d0d765 | 16 | if(mode == INPUT) |
rbohne | 0:a4ee09d0d765 | 17 | { |
rbohne | 0:a4ee09d0d765 | 18 | allpins[pin].input(); |
rbohne | 0:a4ee09d0d765 | 19 | } |
rbohne | 0:a4ee09d0d765 | 20 | if(mode == OUTPUT) |
rbohne | 0:a4ee09d0d765 | 21 | { |
rbohne | 0:a4ee09d0d765 | 22 | allpins[pin].output(); |
rbohne | 0:a4ee09d0d765 | 23 | } |
rbohne | 0:a4ee09d0d765 | 24 | |
rbohne | 0:a4ee09d0d765 | 25 | } |
rbohne | 0:a4ee09d0d765 | 26 | |
rbohne | 0:a4ee09d0d765 | 27 | int digitalRead(int pin) |
rbohne | 0:a4ee09d0d765 | 28 | { |
rbohne | 0:a4ee09d0d765 | 29 | //allpins[pin].input(); |
rbohne | 0:a4ee09d0d765 | 30 | return allpins[pin].read(); |
rbohne | 0:a4ee09d0d765 | 31 | } |