aboutsummaryrefslogtreecommitdiff
path: root/c/arduino/test.ino
blob: ce487124c6a95ea6a13464a26c1a01d2032b4df9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#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.print(message[i]);
    } 
  }
  else {
    digitalWrite(ERR_PIN, HIGH);
    lcd.clear();
    lcd.print("txerr: ");
    lcd.print(e);
  }
}

void setup() {
  init_ace(9600, 200);
  lcd.begin(16,2);
  lcd.clear();
  lcd.print("ready");
  pinMode(ERR_PIN, OUTPUT);
}

uint8_t i = 0;
void loop() {
  delay(1000);
  i += 1;
  ace_send0(1, &i);
}