|
661
|
Using Arduino / Project Guidance / Re: Telescope control indiserver - Firmata - real time commands
|
on: December 02, 2012, 08:43:50 pm
|
What a great project. The way you've described the system, I'd look at modifying the firmata GUI program to accept inputs from your server. Can't say how hard that would be without seeing the source, presuming it is open. If you're not wedded to a firmata solution, I've published a web front-end toolkit for Bitlash named Bitlash Commander that allows control of an Arduino from a web interface using Bitlash script. It's a similar architure with Bitlash substituted for firmata. You could build your control interface as a Commander page and extend Commander to accept input from the indiserver, same as you're looking at for the firmata path. Bitlash Commander: https://github.com/billroy/bitlash-commanderBitlash: http://bitlash.net-br
|
|
|
|
|
662
|
Using Arduino / Interfacing w/ Software on the Computer / Re: Two way serial communication with raspberry Pi (radio project)
|
on: December 02, 2012, 07:54:58 am
|
I wonder if the bootloader is eating your data. Immediately after the serial port is opened, the Arduino spends about 1500ms in the bootloader waiting to see if you are about to upload a new sketch. During this time, any serial output sent from the PC side is interpreted by the bootloader, not your program. Mostly, it is ignored. Just like what you are seeing. The unix 'echo' command opens the port and writes to it right away. This works fine on the serial monitor, but because of the bootloader problem it won't work on arduino. If this reasoning is sound, you need a little program to open the serial port and wait a couple seconds before sending the playlist length, rather than using 'echo'. -br Edit: Another way, besides waiting a fixed time, is to wait for a character string from the arduino to signal 'ready'. Bitlash, for example, sends '\n> ' as a prompt when it's ready. You can see this at work in the bloader.js program, which uploads files to Arduino over the serial port: https://github.com/billroy/bloader.js/blob/master/bloader.js
|
|
|
|
|
665
|
Using Arduino / Programming Questions / Re: Struggling with switching Arduino and Random numbers
|
on: December 02, 2012, 07:20:42 am
|
I bet they don't turn on all at once, but rather one at a time, very quickly, since there is no code to turn them off. Perhaps something more like this: int lit = 3; // save the lit one so we can turn it off
void loop() { if (digitalRead(switchPin)) { // button pressed? digitalWrite(lit, LOW); // turn off the old one lit = random(3,10); // pick a new one digitalWrite(lit, HIGH); // turn it on } }
-br
|
|
|
|
|
666
|
Using Arduino / Programming Questions / Re: A little help with digitalRead
|
on: December 01, 2012, 07:39:53 pm
|
As Holmes says, put: int prog_number;
before the giant if statement, and don't say "int prog_number=x" just "prog_number=x" in the if statement blocks. It looks like you are setting prog_number to 1 in the fourth giant if statement. Is that what you intended? -br
|
|
|
|
|
670
|
Using Arduino / Project Guidance / Re: glcd menu help
|
on: November 30, 2012, 07:47:35 am
|
I believe what you want is a function call: void menu() { GLCD.print("start"); val=digitalRead(button1); if (val==HIGH) doSomething(); }
void loop() { …code... }
void doSomething() { …code… }
-br
|
|
|
|
|
671
|
Using Arduino / Programming Questions / Re: Arduino uno with ethernet shield problems
|
on: November 29, 2012, 09:06:20 pm
|
The IP address may indeed be the problem, as you suspect. The one in the program is on a different network from the gateway, which doesn't work. Change the 3 in the third octet to a 1 to match the gateway: //byte ip[] = { 192, 168, 3, 178 }; //ip address -- wrong network byte ip[] = { 192, 168, 1, 178 }; //ip address -- maybe right network
I say maybe because your actual network might be set up differently. If this doesn't work, it will next help to tell us the IP address of your PC. -br
|
|
|
|
|
672
|
Using Arduino / Networking, Protocols, and Devices / Re: Handling serial parity errors
|
on: November 29, 2012, 07:25:18 pm
|
The '328p datasheet (here: http://www.atmel.com/Images/doc8161.pdf), section 19, page 176, is the place to start in understanding parity support in the hardware. It looks like it both generates the parity bit on output and checks it on input. See 19.7.4 for Receiver Error flags. One issue with the Arduino buffered serial input (since you're not managing it yourself) will be knowing _which_ character was in error when the error flag lights up. Good luck with your project. -br
|
|
|
|
|