Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Need help with code on: February 20, 2006, 02:58:27 am
Hello!

Im trying to build some kind of thermometer with arduino that is also going to work as a lamp. Im going to put diffrent colored leds behind a sheet of plexiglas and they will lit up the plexi with diffrent kind of colors depending on the temprature outside. Im going to have 12 leds connected to 12 pins at arduino.

But I have problem with the code and getting the leds to light up togheter. So that I can have that led 1,2,3 lights at one temprature and led 2,3,4 lights at another and 4,5,6,7,8 lights and so on. With the code below I only get the led blinking and not working at all at their designated temprature.


This is what I have writen so far but I think there are some more easier way to write this. The code below is far from ready and Im only using 2 leds so far even if I have declared 12 in the begining so dont be scared away. :-)





int ledPin1 = 1;  
int ledPin2 = 2;    
int ledPin3 = 3;  
int ledPin4 = 4;    
int ledPin5 = 5;  
int ledPin6 = 6;    
int ledPin7 = 7;  
int ledPin8 = 8;    
int ledPin9 = 9;  
int ledPin10 = 10;    
int ledPin11 = 11;  
int ledPin12 = 13;    

int lightPin = 0;      
int val = 0;

int value1 = 150;
int value2 = 151;    
int value3 = 152;    
int value4 = 153;    
int value5 = 160;    
int value6 = 165;    
int value7 = 156;    
int value8 = 157;    
int value9 = 158;    
int value10 = 150;    
int value11 = 150;    
int value12 = 150;          

void setup() {
 pinMode(ledPin12, OUTPUT);
 pinMode(ledPin1, OUTPUT);
   pinMode(ledPin2, OUTPUT);
     pinMode(ledPin3, OUTPUT);
       pinMode(ledPin4, OUTPUT);
 beginSerial(9600);        
}

void loop() {

 val = analogRead(lightPin)/4;

 
    printInteger(val);
    printByte(10);
    printByte(13);


 
if(val<value1 ){
     

       digitalWrite(ledPin12, HIGH);
 }
 
else (  digitalWrite(ledPin12, LOW));


 
 if(val>value4 ){
 
     if(val<value5 ){

       digitalWrite(ledPin4, HIGH);
 }
 
  else (  digitalWrite(ledPin4, LOW));
  }
 
else (  digitalWrite(ledPin4, LOW));



  if(val>value5 ){
 
     if(val<value6 ){

       digitalWrite(ledPin4,  HIGH);
        digitalWrite(ledPin12,  HIGH);
 }
 
  else (  digitalWrite(ledPin4, LOW));
  }
 
else (  digitalWrite(ledPin4, LOW));



 delay (200);

}

smiley smiley
2  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: October 09, 2008, 04:54:07 am
I have tested all the examples except the animation one and they all work perfectly with 4 tlc5940 in series and arduino 0012 Alpha. will do some longer tests with the code to see if it starts acting weird since this was just a quick one (uploading checking that it fades correctly and then the next one)

thanks a lot for the updated code.  btw some of the examples could need some modifications (in my view) regarding scaling them up to more than one TLC5940. Some of them are but some are not. Like always multiply the variable NUM_TLCS with 16 everywhere and so on. I could take a quick look at it and send you some updated versions if you like to.

*edit* on a closer look it is only example "testfade02" that needs to be updated to fit multiple TLC5940.
3  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: October 06, 2008, 07:17:23 am
I have created a breakout board for this circuit for a more simple and quick build of projects and experiments. Take a look at http://www.instructables.com/id/The_Dawm/ where I have put a short instruction how to solder it together with some pictures. I also refer to your library acleone hope that is alright...

The nice thing of the breakout board is that it is easily connectable after each other creating a lot  of outputs fast together with the TLC5940 library

If anyone is interested in a breakout board please mail me or soon look at http://blushingboy.org/ where it will be sold as soon as the page is ready...
4  Forum 2005-2010 (read only) / News / Arduino at http://www.makezine.com/blog/ on: March 04, 2006, 05:11:09 pm
I surfed around at this page http://www.makezine.com/blog/ and noticed that arduino was posted there. Nothing special just nice to see the word is spreading.

direct link http://www.makezine.com/blog/archive/2006/03/pc_to_real_world_interfacing_u.html
5  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: how/where to connect a light sensor 3 pin on: February 21, 2006, 05:11:46 pm
oki maybe if u look at this page it will help u some

http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/ldr.html

good luck
6  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: how/where to connect a light sensor 3 pin on: February 19, 2006, 12:58:38 pm
the sensor will probably work just like an ordinary potientiometer and that means that u will connect the power to the power connection on arduino and the ground to the ground on the arduino. the white cable u will connect to a analog pin.

then u use this code


int ledPin = 13;    
int lightPin = 0;      
int val = 0;  
int value1 = 575;        

void setup() {
 pinMode(ledPin, OUTPUT);
 beginSerial(9600);        
}

void loop() {

 val = analogRead(lightPin);

 
    printInteger(val);
    printByte(10);
    printByte(13);


 
if(val<value1){
     

       digitalWrite(ledPin, HIGH);
 }
 
else (  digitalWrite(ledPin, LOW));
 
         delay(200);
}




that code will get the value from the lightsensor and send it over serial to the computer (I guess it works the same with usb but since I have only worked with the serial version of arduino Im not sure) and if the value is under the value u state in the integer value1 (default to 575 this may need tweaking to match your sensor) the led at pin 13 will light up

then u can also read the value 0-1024 in a program like terminal which u can find here at the site to.

I hope this will help u.
7  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Running Arduino on 64bits os on: February 19, 2006, 01:01:17 pm
the problem is solved. I borrowed a friends arduino and tried it at my computer with 64 bit xp running and the things works just fine. It must be some hardware problem with my arduino board.

but thx for the support anyways  smiley
8  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Running Arduino on 64bits os on: February 17, 2006, 10:39:27 am
the com port shows up in tools/serial port and I have changed the port speed to 9600 (I have a older arduino board) and also changed the port speed in the preferences file since Im using the 0003 software with an older board. (built by myself at a k3 course this autum)

the error messge I get is [VP 1] Device is not responding correctly.

the com port shows up in the device manager if thats what u mean

I have also tried the trick with double clicking the export button in arduino software that I saw in this forum but that didnt help either.
9  Forum 2005-2010 (read only) / Frequently-Asked Questions / Running Arduino on 64bits os on: February 17, 2006, 12:43:54 am
Hi!

I have a arduino board and is trying to run the thing on win xp 64 bits but I dont get it to work. All I get is that it dosnt finds the serial port. I reset the board before uploading and evrything and the board and cable is working perfectly in ordinary win xp (32). Is it just my configuration in my windows or is the software  and hardware not compatible with 64 bits windows? It would be very anoying to be forced to switch os beacause of this.
Pages: [1]