i work with an int(16b) to display a 8bit(8 leds) led colom. i bitshift 8 times to the left and then OR this with another int and itself. like this: printset[0][a]=dataset[dispthis][a]<<8; printset2[0][a]=printset[0][a]|dataset[dispthis2][a];
now i get two characters behind eachother, then scroll them to the left. When it scrolls 7 times i do the above trick again. This in a loop will do the thing.
i want to make a textscroll program. I have this code, but the scroll is not continues... I want to scroll the next character if the first is full shown-1. Now it scrolls the character from right to left. When the character left the 8x8led on the left (so 8x8 is clean) than the next character is comming on the right. So i have a gab of 8 positions (maybee 6, i don't want then to get close together)
Code:
//8x8 led//
const int num_rows=8; const int num_cols=8;
const int clockpinrow=10; //pin 11 van de 74ch595 const int rowdatapin=8; //pin 14 van de 74ch595 const int rowlatchpin=9; //pin 12 van de 74ch595
const int clockpincol=13; //pin 11 van de 74ch595 const int coldatapin=11; //pin 14 van de 74ch595 const int collatchpin=12; //pin 12 van de 74ch595
I bought a couple of 8x8 led matrices on ebay. I tested them with a resistor and a 5v power supply. I managed to find out the right connection to led up every dot. Works fine!
So the next step was to make drive it with the arduino. I ordered two 74c595 chips. One for the anode, and one for the cathode. A couple of resistors in between.
It didn't work, so i broke it down. I decided to set up 4 leds with the same idea. One side to the resistors and the 74ch595 and other side to another 74ch595. So when i set the first bit of the 74ch595 to 1(+5V) and the first bit of the other 74ch595 to 0(0V) then the led must lit. Otherway around it stays off.
my code:
Code:
// simple 4 led setup. // 2x 74ch595, 1 for anode, 1 for kathode // use to test with troubles with 8x8led matrix common anode. // 4 pins of the 74ch595 are used (A0-A3)
int latchrow = 12; //pin 11 74ch595 int latchcol = 10; //pin 11 74ch595 int clockPin = 9; //pin 12 74ch595 int datarow = 11; //pin 14 74ch595 int datacol = 8;//pin 14 74ch595
byte ledcol = B00001111; byte ledrow = B00001101;
void setup() { //set pins to output so you can control the shift register pinMode(latchrow, OUTPUT); pinMode(latchcol, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(datarow, OUTPUT); pinMode(datacol, OUTPUT); }
digitalWrite(latchcol, LOW); // shift the bits out: shiftOut(datacol, clockPin, MSBFIRST, ledcol); // turn on the output so the LEDs can light up: digitalWrite(latchcol, HIGH); }
I am working on my arduino2arduino communication project. Want to make my gardenlights go on and off with my Android-phone (website).
I tested all parts as modules and it looks good.
I use a 433rf trans and recieve module and the virtualwire.lib. The webserver on the transside is looking for a button to press, when it is i want to change the *msg value. In my setup i set the msg value to: GALLO. When the button are pressed i want to change it to: "A" / "U" / "1" etc etc. But i can't get it to work. (the msg char is not chancing). I think i have a problem to define the msg char.
Can anybody check my code and help me a little bit?
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address byte ip[] = { 192, 168, 254, 200 }; // ip in lan byte gateway[] = { 192, 168, 254, 1 }; // internet access via router byte subnet[] = { 255, 255, 255, 0 }; //subnet mask EthernetServer server(80); //server port
String readString;
////////////////////// int ledvalue=125; int index=0; int temp[30]; int sensorPin = A5; // select the input pin for the potentiometer int ledPin = 13; // select the pin for the LED int sensorValue = 0; // variable to store the value coming from the sensor int sdcard=4; int sdcardoff=HIGH; char *msg="GALLO";
void setup(){
pinMode(5, OUTPUT); //pin selected to control
// Initialise the IO and ISR vw_set_ptt_inverted(true); // Required for DR3100 vw_set_tx_pin(8); vw_setup(2000); // Bits per sec
//start Ethernet Ethernet.begin(mac, ip, gateway, subnet); server.begin(); //enable serial data print Serial.begin(9600); Serial.println("server LED test 1.0"); // so I can keep track of what is loaded Serial.println(versie); pinMode(sdcard,sdcardoff); }
void loop(){ RFtrans(); ledcontrol(); }
int ledcontrol(){ // Create a client connection EthernetClient client = server.available(); if (client) { while (client.connected()) { if (client.available()) { char c = client.read();
//read char by char HTTP request if (readString.length() < 100) { //store characters to string readString += c; //Serial.print(c); }
//if HTTP request has ended if (c == '\n') {
///////////////
// Serial.println(readString); //print to serial monitor for debuging
if(readString.indexOf("?aan") >0){//checks for off Serial.print("AAN"); const char *msg = "A"; RFtrans(); }
if(readString.indexOf("?uit") >0){//checks for off char *msg = "U"; Serial.print("UIT"); RFtrans(); }
if(readString.indexOf("?35") >0){//checks for off char *msg = "1"; RFtrans(); }
if(readString.indexOf("?70") >0){//checks for off char msg = '5'; RFtrans(); }
if(readString.indexOf("?150") >0){//checks for off char msg = '2'; RFtrans(); }
} }
} } }
int RFtrans(){ Serial.print("MSG: "); Serial.println(msg); analogWrite(6, 255); // Flash a light to show transmitting vw_send((uint8_t *)msg, strlen(msg)); vw_wait_tx(); // Wait until the whole message is gone analogWrite(6, 0); delay(200); }
I did the following: placed a 560r to +5v, connected the otherside of the resistor to pin 1. took another wire and connected it to pin 13, the other end to -(gnd).
I bought a very cheap 8x8 ledmatrix bi color (red/green). Can anybody tell me test it (fast and simple)? Can i just connect 2 wires to my arduino(uno)and the pins to test the leds?
for example: use the blink example to use as input for the matrix.....
Thanks, i did it right away. But it left me with the next error codes.....
transmitter.cpp: In function 'void setup()': transmitter.pde:-1: error: 'vw_set_ptt_inverted' was not declared in this scope transmitter.pde:-1: error: 'vw_setup' was not declared in this scope transmitter.cpp: In function 'void loop()': transmitter.pde:-1: error: 'vw_send' was not declared in this scope transmitter.pde:-1: error: 'vw_wait_tx' was not declared in this scope
It looks like the arduino software doesn't read the lib good.
I having problems with Arduino 1.0 and even r22 and the virtualwire library. I can't get it working!
I use the simple example from the lib. When i verify the code i get errorcodes like this: In file included from transmitter.cpp:11: C:\Users\prive\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:14:20: error: wiring.h: No such file or directory In file included from transmitter.cpp:11: VirtualWire.h:53: error: variable or field 'vw_set_tx_pin' declared void VirtualWire.h:53: error: 'uint8_t' was not declared in this scope VirtualWire.h:57: error: variable or field 'vw_set_rx_pin' declared void VirtualWire.h:57: error: 'uint8_t' was not declared in this scope VirtualWire.h:61: error: variable or field 'vw_set_ptt_pin' declared void VirtualWire.h:61: error: 'uint8_t' was not declared in this scope VirtualWire.h:65: error: variable or field 'vw_set_ptt_inverted' declared void VirtualWire.h:65: error: 'uint8_t' was not declared in this scope VirtualWire.h:70: error: variable or field 'vw_setup' declared void VirtualWire.h:70: error: 'uint16_t' was not declared in this scope VirtualWire.h:89: error: 'uint8_t' does not name a type VirtualWire.h:95: error: 'uint8_t' does not name a type VirtualWire.h:98: error: 'uint8_t' does not name a type VirtualWire.h:103: error: 'uint8_t' does not name a type transmitter.cpp: In function 'void setup()': transmitter.pde:-1: error: 'vw_set_ptt_inverted' was not declared in this scope transmitter.pde:-1: error: 'vw_setup' was not declared in this scope transmitter.cpp: In function 'void loop()': transmitter.pde:-1: error: 'vw_send' was not declared in this scope
I bought my RD413kit from ebay... Yes, sorry guys. But the price was so good i thought lets have a try. Now i'm testing the kit. But it doesn't do what i'm thinking it should. So, it does nothing at all (hahaha).
Can anybody tell me how i can test the kit? So i can be sure it is working, or not. If it is not i'm going to mail the ebay seller. If it is, i'm very happy. LOL