Attempting to create a class (no errors on compile but no response from Arduino)


hello,

i've been struggling past couple of days arduino code. created class/library manage columns (which in turn uses lpd8806.h, spi.h, , lpd8806.cpp), , compiles no errors.

code: [select]
#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


code: [select]
#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 simple arduino code:

code: [select]
#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, never run setup(). commenting out column1 can serial messages. ideas on i'm doing wrong? libraries/column contains: column.cpp, column.h, lpd8806.cpp, lpd8806.h.

quote
the code compiles perfectly, never run setup(). commenting out column1 can serial messages. ideas on i'm doing wrong?

yes. think know when constructors called. don't. doing far in constructors.


Arduino Forum > Using Arduino > Programming Questions > Attempting to create a class (no errors on compile but no response from Arduino)


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial