view service/busyboxArduino/main.ino @ 958:f83d494b0f31

start buttons+lcd program Ignore-this: 7bcbbbbbc21984988c87a06e1cb582f1 darcs-hash:20150104073406-312f9-0fdaf43c639503fac5b4100dcf0f8ede1463866b
author drewp <drewp@bigasterisk.com>
date Sat, 03 Jan 2015 23:34:06 -0800
parents
children 28c2db876548
line wrap: on
line source

#include <Arduino.h>
#include <LiquidCrystal.h>

#define I2C_ADDR      0x27 // I2C address of PCF8574A
#define BACKLIGHT_PIN 3
#define En_pin        9
#define Rw_pin        1
#define Rs_pin        8
#define D4_pin        4
#define D5_pin        5
#define D6_pin        6
#define D7_pin        7

LiquidCrystal twilcd(Rs_pin, Rw_pin, En_pin, D4_pin, D5_pin, D6_pin, D7_pin, BACKLIGHT_PIN, POSITIVE);

#define debugLed 13


void setup(void) {
  int i;
  pinMode(debugLed, OUTPUT);

  Serial.begin(115200);
  
  twilcd.begin(16,2);
  twilcd.setBacklight(HIGH);
  twilcd.home();
  //1234567890123456
  //I2C/TWI BackPack
  twilcd.print("hello world");
  // ana read and display
  while (1) {
    while (Serial.available() <= 2) {
    }
    i = Serial.read();
    if (i != 0x60) {
      continue;
    }
    i = Serial.read(); // command
    if (i == 0) { // set strip: 0x60 0x00 <numPixels * 3 bytes>
      digitalWrite(debugLed, 1);
      delay(1000);
      digitalWrite(debugLed, 0);
    } else {
        // unknown command
    }
  }
}

void loop() {
}