Test arduino code
Fork of ArduinoHAL by
Revision 0:a4ee09d0d765, committed 2011-06-04
- Comitter:
- rbohne
- Date:
- Sat Jun 04 19:44:05 2011 +0000
- Child:
- 1:c9f5b6330d8d
- Commit message:
- digitalWrite, digitalRead, and pinMode implemented
Changed in this revision
| Arduino.c | Show annotated file Show diff for this revision Revisions of this file |
| Arduino.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Arduino.c Sat Jun 04 19:44:05 2011 +0000
@@ -0,0 +1,31 @@
+#include "Arduino.h"
+#include "mbed.h"
+
+
+
+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};
+
+void digitalWrite(int pin, int value)
+{
+ //allpins[pin].output();
+ allpins[pin].write(value);
+}
+
+void pinMode(int pin, int mode)
+{
+ if(mode == INPUT)
+ {
+ allpins[pin].input();
+ }
+ if(mode == OUTPUT)
+ {
+ allpins[pin].output();
+ }
+
+}
+
+int digitalRead(int pin)
+{
+ //allpins[pin].input();
+ return allpins[pin].read();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Arduino.h Sat Jun 04 19:44:05 2011 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" + +#define HIGH 0x1 +#define LOW 0x0 + +#define INPUT 0x0 +#define OUTPUT 0x1 + +//#define true 0x1 +//#define false 0x0 + + +void pinMode(int, int); +void digitalWrite(int, int); +int digitalRead(int); \ No newline at end of file
frederic blanc
