aboutsummaryrefslogtreecommitdiff
path: root/c/arduino/test.ino
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2013-02-26 16:44:22 +0100
committerJakob Odersky <jodersky@gmail.com>2013-02-26 16:44:22 +0100
commite8e5650006961593559b57176c4d2916b5c32d4e (patch)
tree4d93ffef4ba1439cec0b3f15928963ddd88cc6e7 /c/arduino/test.ino
parenta9ef6d2ce9ab5f8f7d5d7993fa281f89e756d09a (diff)
downloadace-e8e5650006961593559b57176c4d2916b5c32d4e.tar.gz
ace-e8e5650006961593559b57176c4d2916b5c32d4e.tar.bz2
ace-e8e5650006961593559b57176c4d2916b5c32d4e.zip
restructure c implementation directory
Diffstat (limited to 'c/arduino/test.ino')
-rw-r--r--c/arduino/test.ino44
1 files changed, 44 insertions, 0 deletions
diff --git a/c/arduino/test.ino b/c/arduino/test.ino
new file mode 100644
index 0000000..e9df65f
--- /dev/null
+++ b/c/arduino/test.ino
@@ -0,0 +1,44 @@
+#include "Arduino.h"
+
+#include "LiquidCrystal.h"
+#include "ace.h"
+
+LiquidCrystal lcd(8, 9, 4, 5, 6, 11);
+
+#define ERR_PIN 3
+
+void ace_event(message_event e, int16_t size, const uint8_t* const message) {
+
+ if (e == 0 || e == 1) {
+ digitalWrite(ERR_PIN, LOW);
+ lcd.clear();
+ for(int i = 0; i < size; ++i) {
+ lcd.write(message[i]);
+ }
+ }
+ else {
+ digitalWrite(ERR_PIN, HIGH);
+ lcd.clear();
+ lcd.print(e);
+ }
+}
+
+void setup() {
+ init_ace(115200, 20);
+ lcd.begin(16,2);
+ lcd.clear();
+ lcd.print("ready");
+ pinMode(ERR_PIN, OUTPUT);
+}
+
+uint8_t i = 0;
+void loop() {
+
+ lcd.clear();
+ lcd.print("|");
+
+
+ delay(1000);
+ ace_send0(1, &i);
+ delay(1000);
+}