Hello,
I’ve been struggling for the past couple of days with my Arduino code. I created a class/library to manage columns (which in turn uses the LPD8806.h, SPI.h, and LPD8806.cpp), and it compiles with no errors.
#ifndef Column_h
#define Column_h
#include "Arduino.h"
#include "LPD8806.h"
class Column
{
public:
Column(int dataPin, int clockPin, int hoverSensorPin, int dropSensorPin);
private:
LPD8806 _strip;
int _freeSpot, _hoverSensorPin, _dropSensorPin, _led;
byte _hoverState, _dropState;
uint32_t _red, _yellow, _green;
bool _startHover, _hover;
unsigned long _timeHoverStart;
};
#endif
#include "Arduino.h"
#include "Column.h"
Column::Column(int dataPin, int clockPin, int hoverSensorPin, int dropSensorPin) {
_strip = LPD8806(6, dataPin, clockPin);
_strip.begin();
_strip.show();
_red = _strip.Color(127, 0, 0);
_yellow = _strip.Color(127, 127, 0);
_green = _strip.Color(0, 127, 0);
_hoverSensorPin = hoverSensorPin;
pinMode(hoverSensorPin, INPUT);
_hoverState = LOW;
_dropSensorPin = dropSensorPin;
pinMode(dropSensorPin, INPUT);
_dropState = LOW;
_startHover = false;
_hover = false;
_timeHoverStart = 0;
_led = 0;
}
And my simple Arduino code:
#include <Column.h>
#include "SPI.h"
Column column1(22, 23, 52, 53);
void setup() {
Serial.begin(9600);
while (true) {Serial.write('A'); delay(1000);};
}
void loop() {}
The code compiles perfectly, but I never get to run setup(). Only by commenting out column1 can I get Serial messages. Any ideas on what I’m doing wrong? My libraries/Column contains: Column.cpp, Column.h, LPD8806.cpp, LPD8806.h.