Mercurial > code > home > repos > homeauto
changeset 153:f8c5ec994768
start buttons+lcd program
Ignore-this: 7bcbbbbbc21984988c87a06e1cb582f1
author | drewp@bigasterisk.com |
---|---|
date | Sat, 03 Jan 2015 23:34:06 -0800 |
parents | 2a38f2620e5b |
children | 58c47bfe0ce5 |
files | service/busyboxArduino/main.ino service/busyboxArduino/makefile |
diffstat | 2 files changed, 60 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/busyboxArduino/main.ino Sat Jan 03 23:34:06 2015 -0800 @@ -0,0 +1,51 @@ +#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() { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/busyboxArduino/makefile Sat Jan 03 23:34:06 2015 -0800 @@ -0,0 +1,9 @@ +BOARD_TAG = diecimila +USER_LIB_PATH := $(realpath LiquidCrystal_V1.2.1/) +ARDUINO_LIBS = LiquidCrystal Wire +MONITOR_PORT = /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4001lVK-if00-port0 + +include /usr/share/arduino/Arduino.mk + +setup: + ln -sf LiquidCrystal_V1.2.1/LiquidCrystal/LiquidCrystal.cpp LiquidCrystal.cpp