I was curious if anyone has tried this. Since the ks glcd uses the analog pins I was wanting to know if I could set up a second arduino reading the wii nunchuck values via i2c and sending them to the serial port connected to the other with the glcd? My main question is say I'm running both arduinos at the same baudrate, would I have any problems reading a value and printing it to the glcd?
I was curious if anyone has tried this. Since the ks glcd uses the analog pins I was wanting to know if I could set up a second arduino reading the wii nunchuck values via i2c and sending them to the serial port connected to the other with the glcd? My main question is say I'm running both arduinos at the same baudrate, would I have any problems reading a value and printing it to the glcd?
I can't really see any issues you might have although you might want to use newsoftserial as otherwise you would need to unplug the boards when you want to upload code to the arduino board.
There is some code somethere which was written to allow bit-banging of i2c on any digitial pin. Then you could connect your nunchuck to some other pins. I can't find it now. Anyone got any ideas where it is?
Surely you could connect your graphic LCD to some other pins than the analog pins or do you mean that it uses all the pins?
Mowcius
It uses most analog pins. I did c somewhere about doing a digital pin... But if I can get away with one glcd and i2c with wii remote on a single 328 Id be happy.
You can change the pin that the ks0108 library uses. So rather than having the GLCD Enable pin connected to arduino pin 18 (Analog 1, SDA), you could connect it to another unused pin, and remap the value in the ks0108_Arduino.h
The pins used to control the GLCD are all defined at the top of ks0108_Arduino.h, so you can just modify the EN definition:
/*********************************************************/
/* Configuration for assigning LCD bits to Arduino Pins */
/*********************************************************/
/* Arduino pins used for Commands
* default assignment uses the first five analog pins
*/
#define CSEL1 14 // CS1 Bit // swap pin assignments with CSEL2 if left/right image is reversed
#define CSEL2 15 // CS2 Bit
#define R_W 16 // R/W Bit
#define D_I 17 // D/I Bit
[glow]#define EN 18 // EN Bit[/glow]
//#define RES 19 // Reset Bit // uncomment this to contol LCD reset on this pin
I'll just use a second 328.. When I get a chance I'll make up another board or even yet just try on a breadboard and send out serial from the wii remote with the stand alone 328 to the arduino. I'll post what I get :). Ordered a glcd from nkc hope it be here soon.
Got the glcd hooked up. Now I got to try and see about sending serial commands to and from the two arduinos. I'm goin to be running off of one voltage regulator with capacitors. Any value recommended for doing so?
I changed it to this:
#define EN 3 // EN Bit
EN is on digital pin 3 now
I now have analog 4 and 5 free for i2c
Won't need a second arduino unless I run out of program space
Basically what I'm ending up in this is using the Wii nunchuck accelerometer sensors to make a a display in my aircraft to see if I'm in level flight (forgot what instrument is called)
Going to take the values of the nunchuck (it'll be takin apart) read the values and draw a box on the bottom of glcd, have a line go up/down of the box (horizon) and left/right of it..