From 63a4ef93a25d190a72017948be39ba4d105eb842 Mon Sep 17 00:00:00 2001 From: LowPowerLab Date: Tue, 22 Mar 2016 10:09:51 -0400 Subject: [PATCH] Move LCD version to ZIP --- Examples/PiGateway/PiGateway_withLCD.ino | 186 ----------------------- Examples/PiGateway/PiGateway_withLCD.zip | Bin 0 -> 2689 bytes 2 files changed, 186 deletions(-) delete mode 100644 Examples/PiGateway/PiGateway_withLCD.ino create mode 100644 Examples/PiGateway/PiGateway_withLCD.zip diff --git a/Examples/PiGateway/PiGateway_withLCD.ino b/Examples/PiGateway/PiGateway_withLCD.ino deleted file mode 100644 index da80fe5..0000000 --- a/Examples/PiGateway/PiGateway_withLCD.ino +++ /dev/null @@ -1,186 +0,0 @@ -// ********************************************************************************************************** -// GarageMote garage door controller base receiver sketch that works with Moteinos equipped with HopeRF RFM69W/RFM69HW -// Can be adapted to use Moteinos using RFM12B -// This is the sketch for the base, not the controller itself, and meant as another example on how to use a -// Moteino as a gateway/base/receiver -// 2014-07-14 (C) felix@lowpowerlab.com, http://www.LowPowerLab.com -// ********************************************************************************************************** -// Creative Commons Attrib Share-Alike License -// You are free to use/extend this code/library but please abide with the CCSA license: -// http://creativecommons.org/licenses/by-sa/4.0/ -// ********************************************************************************** - -#include //get it here: http://github.com/lowpowerlab/rfm69 -#include //get it here: http://github.com/lowpowerlab/spiflash -#include //get it here: https://github.com/LowPowerLab/WirelessProgramming -#include //comes with Arduino IDE (www.arduino.cc) -#include "ST7036.h" //get it from here: https://bitbucket.org/fmalpartida/st7036-display-driver/src/ -#include "LCD_C0220BiZ.h" //get it from here: https://bitbucket.org/fmalpartida/st7036-display-driver/src/ -#include //comes with Arduino - -//***************************************************************************************************************************** -// ADJUST THE SETTINGS BELOW DEPENDING ON YOUR HARDWARE/SITUATION! -//***************************************************************************************************************************** -#define NODEID 1 -#define NETWORKID 200 -#define FREQUENCY RF69_915MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ) -#define ENCRYPTKEY "thisIsEncryptKey" //has to be same 16 characters/bytes on all nodes, not more not less! -#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W! -#define LED 9 -#define FLASH_CS 8 -#define SERIAL_BAUD 115200 -#define SERIAL_EN //comment out if you don't want any serial verbose output -#define ACK_TIME 30 // # of ms to wait for an ack -#define BACKLIGHTPIN 5 //3=R,5=G,6=B -//***************************************************************************************************************************** - -#ifdef SERIAL_EN - #define DEBUG(input) {Serial.print(input); delay(1);} - #define DEBUGln(input) {Serial.println(input); delay(1);} -#else - #define DEBUG(input); - #define DEBUGln(input); -#endif - -RFM69 radio; -SPIFlash flash(FLASH_CS, 0xEF30); //EF40 for 16mbit windbond chip - -//initialize LCD -ST7036 lcd = ST7036(2, 20, 0x78, BACKLIGHTPIN); //row count, column count, I2C addr, pin for backlight PWM -byte battChar[8] = {0b00000,0b01110,0b11111,0b11111,0b11111,0b11111,0b11111,0}; -byte rssiChar[8] = {0b00000,0b00100,0b10101,0b01110,0b00100,0b00100,0b00100,0}; - -void setup() { - Serial.begin(SERIAL_BAUD); - delay(10); - radio.initialize(FREQUENCY,NODEID,NETWORKID); -#ifdef IS_RFM69HW - radio.setHighPower(); //uncomment only for RFM69HW! -#endif - radio.encrypt(ENCRYPTKEY); - char buff[50]; - sprintf(buff, "\nListening @ %dmhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915); - DEBUGln(buff); - if (flash.initialize()) - { - DEBUGln("SPI Flash Init OK!"); - } - else - DEBUGln("SPI Flash Init FAIL! (is chip present?)"); - - lcd.init(); - lcd.setContrast(10); - lcd.clear(); - lcd.load_custom_character(0, battChar); - lcd.load_custom_character(1, rssiChar); - lcd.setCursor(0,0); - lcd.print(buff); -} - -byte ackCount=0; -byte inputLen=0; -char input[64]; -byte buff[61]; -char LO[20]; -char BAT[20]; -char temp[25]; -String inputstr; -void loop() { - inputLen = readSerialLine(input, 10, 64, 10); //readSerialLine(char* input, char endOfLineChar=10, byte maxLength=64, uint16_t timeout=10); - inputstr = String(input); - inputstr.toUpperCase(); - - if (inputLen > 0) - { - if (inputstr.equals("KEY?")) - { - DEBUG("ENCRYPTKEY:"); - DEBUG(ENCRYPTKEY); - } - - byte targetId = inputstr.toInt(); //extract ID if any - byte colonIndex = inputstr.indexOf(":"); //find position of first colon - if (targetId > 0) inputstr = inputstr.substring(colonIndex+1); //trim "ID:" if any - if (targetId > 0 && targetId != NODEID && targetId != RF69_BROADCAST_ADDR && colonIndex>0 && colonIndex<4 && inputstr.length()>0) - { - - inputstr.getBytes(buff, 61); - //DEBUGln((char*)buff); - //DEBUGln(targetId); - //DEBUGln(colonIndex); - if (radio.sendWithRetry(targetId, buff, inputstr.length())) - { - DEBUGln("ACK:OK"); - } - else - DEBUGln("ACK:NOK"); - } - } - - if (radio.receiveDone()) - { - int rssi = radio.RSSI; - DEBUG('[');DEBUG(radio.SENDERID);DEBUG("] "); - if (radio.DATALEN > 0) - { - for (byte i = 0; i < radio.DATALEN; i++) - DEBUG((char)radio.DATA[i]); - DEBUG(" [RSSI:");DEBUG(rssi);DEBUG("]"); - } - - CheckForWirelessHEX(radio, flash, false); //non verbose DEBUG - - if (radio.ACKRequested()) - { - byte theNodeID = radio.SENDERID; - radio.sendACK(); - DEBUG("[ACK-sent]"); - } - DEBUGln(); - Blink(LED,3); - - lcd.clear(); - lcd.setCursor(0,0); - - //if (radio.DATALEN < RF69_MAX_DATA_LEN) radio.DATA[radio.DATALEN]=0; - byte matches = sscanf((const char*)radio.DATA, "%s BAT:%s", LO, BAT); - if (matches==2) - { - lcd.print(LO); - lcd.setCursor(0,14); - lcd.print(char(0)); - lcd.setCursor(0,15); - lcd.print(BAT); - } - else lcd.print((const char*)radio.DATA); - - lcd.setCursor(1,14); - lcd.print(char(1)); - lcd.setCursor(1,16); - lcd.print(rssi); - } -} - -void Blink(byte PIN, int DELAY_MS) -{ - pinMode(PIN, OUTPUT); - digitalWrite(PIN,HIGH); - delay(DELAY_MS); - digitalWrite(PIN,LOW); -} - -//readSerialLine already defined in WirelessHEX69 -// reads a line feed (\n) terminated line from the serial stream -// returns # of bytes read, up to 255 -// timeout in ms, will timeout and return after so long -//byte readSerialLine(char* input, char endOfLineChar=10, byte maxLength=64, uint16_t timeout=10); -//byte readSerialLine(char* input, char endOfLineChar, byte maxLength, uint16_t timeout) -//{ -// byte inputLen = 0; -// Serial.setTimeout(timeout); -// inputLen = Serial.readBytesUntil(endOfLineChar, input, maxLength); -// input[inputLen]=0;//null-terminate it -// Serial.setTimeout(0); -// //Serial.println(); -// return inputLen; -//} diff --git a/Examples/PiGateway/PiGateway_withLCD.zip b/Examples/PiGateway/PiGateway_withLCD.zip new file mode 100644 index 0000000000000000000000000000000000000000..48be18dcde70bfdf52afcbe14053209f19c2fccc GIT binary patch literal 2689 zcmV-{3V!uaO9KQH00008069`WMnNT-8ubYP0LB^s02KfL08nX1VRU78VR>J7X>@2z zLqslVZg0&Q{ZHFS_V-Hs506ycI@=K2e55Tj?S>?j9D#625Zh%@t z-|xK{kL?7y)t#=VjZp2G_c`x-T-%19|8KvI7q$(bz0|v5r-@{6qh29Mk`(+TmT3}( zEQP5j7^KW+{104-TPFQE$hjxsE=g|%+;KSvV!-1>0Q=XHFBUA&+sDa*4Ub@WblP}- zX{*QarIOqBVwf`U0&gJ^TPCnXF*%#1;PDO7x!Z>de>~>`@K4T}(P4&q(vlRcL7Ygn zDrwH8VBxF=UK~KgyjX%KaFHNd3hdsC79oQqhIw*l6!4U=ObvyOW|8d9d$382ZS0`X zwjFnO%Xz!y?t;~>!iPcmilAQIy02T2iKb3ZuD~vaMFgZyEHt&tkz8{+DD42!UD3SY{-f-Ajfh zmE;mX378%7Y3ij9FkMPOn^M4dQywrK1mu-=d(?tZ^W9gBGqd=aKE76`o}@Q+h9~Ul z!N3Ymp0bb$aoqh?EBXvavC6U(a<(BqPm`O}iy}<1 zHGRv6Cw-9v%QC!`2209`UZ)Ed1+%9&>b_qsajA^PZ=Ib+eO`HD#95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