Show Posts
Pages: [1]
1  Using Arduino / Installation & Troubleshooting / Re: Keyboard.println() on Leonardo does nothing (for me). on: March 06, 2013, 08:32:53 am
Yep. 1.0.3 fixed it. Thanks.
2  Using Arduino / Installation & Troubleshooting / Re: Keyboard.println() on Leonardo does nothing (for me). on: March 06, 2013, 08:24:55 am
Done - still nothing. I'm using 1.5.1r2, as I have a Due - I'll try it now with 1.0.3.
3  Using Arduino / Installation & Troubleshooting / Keyboard.println() on Leonardo does nothing (for me). on: March 06, 2013, 08:05:54 am
The following sketch does nothing:
Code:
void setup()
{
    Keyboard.begin();
}

void loop()
{
    delay(1000);
    Keyboard.println("Now is the time...");
}

The Leonardo shows up in Windows 7 as 'Arduino Leonardo (COM10)' and 'USB Input Device'. I can add Serial.print() and that shows up. Can't see what I'm doing wrong.

4  Using Arduino / Programming Questions / Re: Problem calling the TimerOne library from my Charlieplex library on: January 25, 2013, 11:05:56 am
Thanks. That fixed it - gave me another error, but there you go.
5  Using Arduino / Programming Questions / Problem calling the TimerOne library from my Charlieplex library on: January 25, 2013, 10:12:30 am
This is Charlieplex.cpp (I have removed most of the code):
Code:
#include "Arduino.h"
#include "Charlieplex.h"

Charlieplex::Charlieplex(char* p, char n)
{

  CharlieIntensity = 0;
}

// Equivalent to digitalWrite, but for a virtual pin
void Charlieplex::wled(int p, char v)
{
  CharlieMode[p] = v;
}

// Equivalent to digitalRead, but for a virtual pin
byte Charlieplex::rled(int p)
{
  return CharlieMode[p];
}

// Turns off all LEDS
void Charlieplex::reset()
{
  int i;
  for(i = 0; i < CharlieNum * 2; i++) CharlieMode[i] = LOW;
}

// Turns on all LEDS
void Charlieplex::set()
{
  int i;
  for(i = 0; i < CharlieNum * 2; i++) CharlieMode[i] = HIGH;
}


void Charlieplex::intensity(unsigned char v)
{
  CharlieIntensity = 7 - v;
}

// Starts Charlieplex, with interval p microseconds between updates
// (p * 1-8) if using intensity
void Charlieplex::start(int p)
{
  Timer1.initialize(400);
  Timer1.attachInterrupt(IntrCharlieplex);
}

// Stops Charlieplex
void Charlieplex::stop()
{
  Timer1.stop();
}

// Interrupt routine, not called by user
void Charlieplex::IntrCharlieplex()
{

}


This is Charlieplex.h:
Code:
#ifndef CHARLIEPLEX_h
#define CHARLIEPLEX_h
#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

#include <TimerOne.h>

class Charlieplex {

  public:
    Charlieplex(char *p, char n);
    void wled(int p, char v);
    byte rled(int p);
    void reset();
    void set();
    void intensity(unsigned char v);
    void start(int p);
    void stop();

  private:
    void IntrCharlieplex();

    int CharlieCurrent;
    byte CharlieNum;
    int CharlieState;
    byte CharlieIntensity;
    byte CharliePins[20];
    byte CharliePairs[380][2];
    byte CharlieMode[380];
};

#endif


And this is the sketch:
Code:
#include <Charlieplex.h>


// Array of pin numbers
char pins[3] = { 11, 12, 13 };

Charlieplex charlieplex(pins, 3);
 
void setup()
{
  char i;


  // If using intensity, periods of > about 400
  // will cause the LEDS to flicker
  charlieplex.start(400);
  for(i = 0; i < 8; i++) {
    // 0 = dim, 7 = full on
    charlieplex.intensity(i);
    charlieplex.set();
    delay(1000);
    charlieplex.reset();
    delay(1000);
  }
  charlieplex.intensity(7);
}

char val;

void loop()
{
  int i;
  charlieplex.rled(3);
  for(i = 0; i < (3 * 2); i++) charlieplex.wled(i, (val >> i) & 1);
  val++;
  if(val >= 60) val = 0;
  delay(1000);
}

The error I get is:

H:\My Documents\Arduino\libraries\Charlieplex\Charlieplex.cpp: In member function 'void Charlieplex::start(int)':
H:\My Documents\Arduino\libraries\Charlieplex\Charlieplex.cpp:60: error: 'Timer1' was not declared in this scope
H:\My Documents\Arduino\libraries\Charlieplex\Charlieplex.cpp: In member function 'void Charlieplex::stop()':
H:\My Documents\Arduino\libraries\Charlieplex\Charlieplex.cpp:67: error: 'Timer1' was not declared in this scope

I can't work out how to fix this.  smiley-sweat
Pages: [1]