Show Posts
Pages: 1 [2] 3 4 ... 7
16  Using Arduino / Programming Questions / clock-driven round robin scheduler on: June 01, 2013, 02:21:21 pm

Im looking for a clock-driven round robin scheduler for the Arduino
Just need an task overrun indicator

I have had look but they all appear to be or close fully blown RTOS's

Any suggestions

17  Using Arduino / Programming Questions / Re: Eclipse linux Jantje's plugin on: May 30, 2013, 07:34:49 pm
Are you sure Eclipse is pointing to the right directory structure
There might be more than one place

I haven't got Eclipse at work so I cant check.

If blink works, try to include the wire.h and work from there
18  Products / Arduino Due / Re: SerialUSB instability - Program stalls on: March 30, 2013, 03:20:23 am
I think your timer may have a hickup when rolling over to zero.

micros() should use a "unsigned long" and not a "double"

19  Using Arduino / Programming Questions / Quadrature Encoder Library on: February 12, 2013, 01:50:29 am
Does anyone know of a library that can read a quadrature encoder and can calculate speed, acceleration, declaration, position etc
Searched the net by found nothing yet

20  Products / Arduino Due / Re: Downloading to due from Ubunti 12.10 with arduino ide on: January 20, 2013, 07:22:36 pm
I ran Ubuntu fine, but is now running Mint (a Ubuntu derivative).
There is/was an issue occasionally with the USB drivers under Linux.
You may want to search for this in the Ubuntu forum.

Does the standard Arduino IDE run and download fine ?
21  Using Arduino / Networking, Protocols, and Devices / Re: Serial.write error when sending an array on: January 15, 2013, 03:24:58 am
Cheers for that.
Coming from a 8bit assembly world, C can be a bit hard to to interpret at time
int used to be a byte for me

getting there
22  Using Arduino / Networking, Protocols, and Devices / Serial.write error when sending an array on: January 15, 2013, 02:57:53 am
the following code has a compiler error, which I don't quite understand

int serialArrayOne[]  = {1,2,3,4,5,6,7,8};

void setup()

void loop()

error is:
sketch_jan15a.cpp: In function ‘void loop()’:
sketch_jan15a.cpp:19:32: error: no matching function for call to ‘HardwareSerial::write(int [8], int)’
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:58:20: note: candidates are: virtual size_t HardwareSerial::write(uint8_t)
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:50:20: note:                 virtual size_t Print::write(const uint8_t*, size_t)
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:49:12: note:                 size_t Print::write(const char*)

The manual says
Serial.write(buf, len)
buf: an array to send as a series of bytes
len: the length of the buffer

Anyone care to enlighten me

23  Using Arduino / Networking, Protocols, and Devices / Sorted - Re: RS485 issue using SoftwareSerial() on: January 14, 2013, 07:38:23 pm

For some reason I commented out 
//#include <RS485_protocol.h>
and included
#include <RS485_non_blocking.h>

when both should be included.
Sometimes you just can't see the forest for the trees

24  Using Arduino / Networking, Protocols, and Devices / Re: RS485 issue using SoftwareSerial() on: January 14, 2013, 01:27:36 pm
Straight from Nick Gammon site
25  Using Arduino / Networking, Protocols, and Devices / RS485 issue using SoftwareSerial() on: January 14, 2013, 01:02:48 am

I have downloaded Nick Gammon code, but are having some compiling issues.
I got it down to 2 errors

//#include "WConstants.h"
#include <RS485_non_blocking.h>
//#include "RS485_protocol.h"
#include <SoftwareSerial.h>

const byte ENABLE_PIN = 4;
const byte LED_PIN = 13;

SoftwareSerial rs485(2, 3);  // receive pin, transmit pin

// callback routines
void fWrite (const byte what)
  rs485.print (what); 
int fAvailable ()
  return rs485.available (); 

int fRead ()
  return (); 

void setup()
  rs485.begin (28800);
  pinMode (ENABLE_PIN, OUTPUT);  // driver output enable
  pinMode (LED_PIN, OUTPUT);  // built-in LED
}  // end of setup
byte old_level = 0;

void loop()

  // read potentiometer
  byte level = analogRead (0) / 4;
  // no change? forget it
  if (level == old_level)
  // assemble message
  byte msg [] = {
     1,    // device 1
     2,    // turn light on
     level // to what level

  // send to slave 
  digitalWrite (ENABLE_PIN, HIGH);  // enable sending
  sendMsg (fWrite, msg, sizeof msg);
  digitalWrite (ENABLE_PIN, LOW);  // disable sending

  // receive response 
  byte buf [10];
  byte received = recvMsg (fAvailable, fRead, buf, sizeof buf);
  digitalWrite (LED_PIN, received == 0);  // turn on LED if error   
  // only send once per successful change
  if (received)
    old_level = level;

}  // end of loop

Errors are:
sketch_jan14a.cpp: In function ‘void loop()’:
sketch_jan14a.cpp:62:35: error: ‘sendMsg’ was not declared in this scope
sketch_jan14a.cpp:67:62: error: ‘recvMsg’ was not declared in this scope

But what do I replace the sendMsg with.
I have looked through the SoftwareSerial.cpp and .h files but nothing springs to mind

Thanks for any suggestions

26  Products / Arduino Due / Re: Using the Hardware Quadrature Encoder Channel on the DUE on: January 10, 2013, 01:58:00 pm

Did you get the encoder to work ?
It appear that only 1 of the the 2 Quadrature channels pins have been connected to pins.
27  Products / Arduino Due / Re: Arduino Due - Accessing registers and inline assembly on: January 03, 2013, 04:46:47 am
I suggest using something like Ken Smith's paper is describing:

"C++ Hardware Register Access Redux"

Its a policy based design using function templates and once setup has clarity and safety.

28  Using Arduino / Programming Questions / Re: trouble with simple IF...ELSE on: December 22, 2012, 03:08:11 pm
Thanks for that
29  Using Arduino / Programming Questions / trouble with simple IF...ELSE on: December 22, 2012, 03:01:41 pm
I can't for the life of me work out why the code below doesn't work.
Never gets to the ELSE statement, something keeps changing the "pinstate" back to zero


void BlinkLED13()
  // blinks LED 13
  int pinstate;      // state of the output pin

  if (pinstate == 0)
    digitalWrite(ledPin, pinstate);
    pinstate = 1; 
    digitalWrite(ledPin, pinstate);
    pinstate = 0;

30  Using Arduino / Programming Questions / Re: Using i/o via an array on: December 20, 2012, 01:57:00 pm

I was so busy thinking about it, before buggering of to work, that I missed the obvious.

Pages: 1 [2] 3 4 ... 7