CapperLabs Greenhouse Controller Table of Contents |
---|
Blog 1 Introduction |
Blog 2 System Components |
Blog 3 Intel Edison |
Blog 4 Grove-y |
Blog 5 Round and Round |
Blog 6 Automatic Vent |
I've been trying out some code on the Intel Edison Arduino board with varying levels of success.
I'd like to be able to see the status of various controls and sensors locally, so I've been trying to interface to
a Sparkfun Nokia 6100 display. None of the published libraries would work as found, but after a few hours of code mods,
I was able to get the interface going.
One of the code changes was the control pin definitions in SparkFunColorLCDShield.h:
#define LCD_PIN_RES 8 // D8
#define LCD_PIN_CS 9 // D9
#define LCD_PIN_DIO 11 // D11
#define LCD_PIN_SCK 13 // D13
There are also two macros for changing the pin states that don't work with the Edison board because they are defined by PORT and BIT locations :
// #define sbi(var, mask) ((var) |= (uint8_t)(1 << mask))
// #define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask))
These lines were commented out.
The rest of the code issues were with SparkFunColorLCDShield.cpp:
The original code sets pin direction (Input/Output) using DDRB, DDRC commands which don't work with the Edison.
Those lines needed to be changed to use the pinMode() command.
pinMode(LCD_PIN_RES, OUTPUT);
pinMode(LCD_PIN_CS, OUTPUT);
pinMode(LCD_PIN_DIO, OUTPUT);
pinMode(LCD_PIN_SCK, OUTPUT);
All the sbi() and cbi() calls needed to be changed to:
digitalWrite(LCD_PIN_XXX, HIGH); //for sbi()
digitalWrite(LCD_PIN_XXX, LOW); //for cbi()
After these changes, the example would compile and run.