@2leon76 — Still working on it — it's a bit of a mess!!
@Nick Gammon
There's been some pulling out of hair here! Over the last couple of months I've been working on the various sub-systems for my Pinewood Derby Car Race Control setup — and progressively, each part came good.
Last weekend, during the process of putting everything together, the whole lot fell apart. Disaster! After through-the-night troubleshooting I eventually got the project back on track - so to speak - apart from one nasty bug. Every time the text-sending Arduino issued a sendstring command the display placed a spurious character at the start of the string. It started out as a white on black bullet point.
Going back to your sample code eradicated the problem so I figured the problem was on the text sending end.
I began hacking at my code wildly — starting by commenting out everything that wasn't a Wire command. It worked! So I started uncommenting various categories of code - like servo commands, button code etc. E v e n t u a l l y … it came down to the button!!
I have one button to control the system — press it to start the race, press it again to reset everything for the next race. I wondered if it might be a conflict with the pin I was using. This is when I discovered that changing the pin changed the spurious character! Huh!?
After much head scratching, this is what it comes down to…
When I do this…
int buttonPin = 2;
void setup ()
{
pinMode(buttonPin, INPUT); /// race control button
digitalWrite(buttonPin, HIGH); /// internal pullup resistor
Wire.begin ();
TWBR = 4; // fast .. fast .. I2C : 16000000 / (16 + 2 * 4) = 666666 Hz
} // end of setup
I get spurious characters appearing at the start of every sendstring.
Removing the buttonPin variable…
// int buttonPin = 2;
void setup ()
{
pinMode(2, INPUT); /// race control button
digitalWrite(2, HIGH); /// internal pullup resistor
Wire.begin ();
TWBR = 4; // fast .. fast .. I2C : 16000000 / (16 + 2 * 4) = 666666 Hz
} // end of setup
… everything plays nicely!
Yep. Assigning the button pin by number, rather than by variable, sorts everything out!
Has anyone else experienced this — or am I 'special'!?
I'll take this opportunity to thank you again for the whole VGAout thing — it's brilliant (in a wonderfully retro way!)
kr Marcel