Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - robrlstn

Pages: 1
1
User Projects / Code Examples / TinyDuino Sparkler
« on: February 21, 2014, 08:00:12 PM »
Make the TinyShield 16 Edge LEDS sparkle. Through each loop a LED is chosen at random and its on-time delay also chosen at random. http://www.youtube.com/watch?v=rwu3iNypoQ0.

The code below is slightly modified code from the TinyDuino Darkness Guage by @tamberg (thank you).

Code: [Select]
// Sparkler (TinyDuino plus TinyShield 16 Edge LEDS) Feb 2014 robrlstn
// One LED at a time choosen at random and on-time rnadom delay
// Majority of code is from TinyDuino Darkness Guage by @tamberg, 14.04.2013
// on TinyCircuits » TinyCircuits Products » User Projects / Code Examples


int wait[5] = {60,40,20,10,5};
void setLedRaw (int px, int wx, int py, int wy,
  int m5, int m6, int m7, int  m8, int m9)
{
  digitalWrite(px, wx);
  digitalWrite(py, wy);
  pinMode(5, m5);
  pinMode(6, m6);
  pinMode(7, m7);
  pinMode(8, m8);
  pinMode(9, m9);     
}

void setLed (int i) {
  switch (i) {
    case 1: setLedRaw(5, HIGH, 6, LOW, OUTPUT, OUTPUT, INPUT, INPUT, INPUT); break;
    case 2: setLedRaw(5, LOW, 6, HIGH, OUTPUT, OUTPUT, INPUT, INPUT, INPUT); break;
    case 3: setLedRaw(5, HIGH, 7, LOW, OUTPUT, INPUT, OUTPUT, INPUT, INPUT); break;
    case 4: setLedRaw(7, HIGH, 5, LOW, OUTPUT, INPUT, OUTPUT, INPUT, INPUT); break;
    case 5: setLedRaw(6, HIGH, 7, LOW, INPUT, OUTPUT, OUTPUT, INPUT, INPUT); break;
    case 6: setLedRaw(7, HIGH, 6, LOW, INPUT, OUTPUT, OUTPUT, INPUT, INPUT); break;
    case 7: setLedRaw(6, HIGH, 8, LOW, INPUT, OUTPUT, INPUT, OUTPUT, INPUT); break;
    case 8: setLedRaw(8, HIGH, 6, LOW, INPUT, OUTPUT, INPUT, OUTPUT, INPUT); break;
    case 9: setLedRaw(5, HIGH, 8, LOW, OUTPUT, INPUT, INPUT, OUTPUT, INPUT); break;
    case 10: setLedRaw(8, HIGH, 5, LOW, OUTPUT, INPUT, INPUT, OUTPUT, INPUT); break;
    case 11: setLedRaw(8, HIGH, 7, LOW, INPUT, INPUT, OUTPUT, OUTPUT, INPUT); break;
    case 12: setLedRaw(7, HIGH, 8, LOW, INPUT, INPUT, OUTPUT, OUTPUT, INPUT); break;
    case 13: setLedRaw(9, HIGH, 7, LOW, INPUT, INPUT, OUTPUT, INPUT, OUTPUT); break;
    case 14: setLedRaw(7, HIGH, 9, LOW, INPUT, INPUT, OUTPUT, INPUT, OUTPUT); break;
    case 15: setLedRaw(9, HIGH, 8, LOW, INPUT, INPUT, INPUT, OUTPUT, OUTPUT); break;
    case 16: setLedRaw(8, HIGH, 9, LOW, INPUT, INPUT, INPUT, OUTPUT, OUTPUT); break;
    default: setLedRaw(5, LOW, 6, LOW, OUTPUT, OUTPUT, INPUT, INPUT, INPUT); // off
  }
}

void setup () {
  pinMode(5, INPUT);
  pinMode(6, INPUT);
  pinMode(7, INPUT);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
}

void loop () {
  int i = random(0,17);
  int RandNum2 = random(0,5);
  setLed(i);
  delay(wait[RandNum2]);
}

2
TinyDuino Processors & TinyShields / Charlieplexing Library
« on: February 11, 2014, 10:00:17 PM »
I've got the TinyShield 16 Edge LEDs board working (please see the short TinyDuinoEdgeLeds clip at:http://www.youtube.com/user/robrlstn/videos.

Code is modification of example on TinyCircuits tutorial page.

PROBELM:  I cannot get the Charlieplexing Library to work at all. I have downloaded that library, put it unzipped into the Arduino/libraries folder, and imported the Library so I can get the #include <Charlieplex.h> statement added to a sketch.

But the example included with that library, SimpleCharlie.pde, will itself not compile, throwing many errors with Arduino 1.0.5.

As an Arduino newbie, I cannot troubleshoot the meaning of these errors. So I cannot tell if I'm doing something wrong or that library has problems.

Thank you in advance for any help.  Robert

Errors:

In file included from _16LEDs_CPlib_1.ino:1:
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:14: error: 'byte' does not name a type
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:15: error: 'byte' does not name a type
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:26: error: expected `)' before '*' token
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:30: error: 'byte' has not been declared
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:31: error: 'byte' has not been declared
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:36: error: 'byte' does not name a type
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:37: error: ISO C++ forbids declaration of 'byte' with no type
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:37: error: expected ';' before '*' token
_16LEDs_CPlib_1:4: error: no matching function for call to 'Charlieplex::Charlieplex(byte [5], int)'
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:20: note: candidates are: Charlieplex::Charlieplex()
C:\Users\RR\Documents\Arduino\libraries\Charlieplex/Charlieplex.h:20: note:                 Charlieplex::Charlieplex(const Charlieplex&)
_16LEDs_CPlib_1:5: error: too many initializers for 'charliePin'
_16LEDs_CPlib_1:6: error: expected `}' before ')' token
_16LEDs_CPlib_1:6: error: too many initializers for 'charliePin'
_16LEDs_CPlib_1:6: error: expected ',' or ';' before ')' token
_16LEDs_CPlib_1:9: error: expected initializer before 'void'

Pages: 1
SMF spam blocked by CleanTalk