| Arduino Forum ::  Members :: Goofballtech
 Show Posts Pages: [1] 2 3 ... 12
 1 Using Arduino / Programming Questions / Re: problem with button to react as switch on: August 27, 2014, 08:23:14 am the difference between those two will be smaller than 32767 up to a different of 32.767 seconds. This is why i said after 32 seconds you might get some strange behavior. If you press the button to toggle your led at 33.1 seconds of different between your timers, what number will be stored in delta_bounce?
 2 Using Arduino / Programming Questions / Re: problem with button to react as switch on: August 26, 2014, 09:47:08 pm I am not an expert but i think your delta_bounce timer can never make it past a few microseconds. Code:    debounce_time_now = millis();                                          delta_bounce = debounce_time_now - debounce_time_past;    debounce_time_past = debounce_time_now;                                 if (delta_bounce >= 50) {                                                         this code is in your loop and runs every time through. So every time your code comes around you are setting delta_bounce to the amount of time it took to run 1 set of loop code. (very small amount of time, will never make it to 50 milliseconds)you might need something more like:Code:int delta_bounce = 50;debounce_time_now = millis();         if (debounce_time_now - debounce_time_past >= delta_bounce) {                    // Do some cool flashy light type stuff          debounce_time_past = debounce_time_now;     }notice that the resetting of the past time doesn't happen until the threshold of 50 has been satisfied already.. this way it wont reset every single loop. btw, just as added information. If a value will only ever be 1 or 0, bool would be a good choice for variable type (button state, led state)and if you want to set the delta_bounce to a variable that cant change, int is fine. If you will calculate the delta_bounce from millis() a long might be a better choice since an int could only handle a time span of 32 seconds before you might get some strange results.
 3 Using Arduino / Programming Questions / Re: Sketch help with "If..else" statements and GoBetWino on: December 03, 2012, 09:30:17 pm The more i think about it the more i need to know more of what you are trying to do and if this is all your code. You can do multiple things at once since they are all checking the same thing..... so you could do this. Code:if (1>50 && 2>50 && 3>50 && 4>50 && 5>50) {display photo1.jpg;display photo2.jpg;display photo3.jpg;display photo4.jpg;display photo5.jpg;display photo6.jpg;}But i would advise assigning names to your pins because using the pin numbers gets to be frustration. In any case to get reading you have to call a function that does so. Code:const byte sensorOne = 1;  // sensor one is connected to pin oneint sensorOneVal;  // create variable to hold the incoming valuesetup(){pinMode(sensorOne, INPUT); // set pin one as an input}loop(){sensorOneVal = analogRead(sensorOne); // read the value of sensor one and store it to sensorOneVal  if (sensorOneVal > 50)  // see if the sensor value was above 50  {  display photo1.jpg  // display the photo, whatever that means....  }}My advice, if you just read what i put in that code block and have no idea whats happening..... start here and read lots more!
 4 Using Arduino / Programming Questions / Re: Sketch help with "If..else" statements and GoBetWino on: December 03, 2012, 09:13:13 pm If the code works like you hope and the "display" command work as you think it will (very unlikely) it would look like this for each comparison:Code:if (1>50 && 2>50 && 3>50 && 4>50 && 5>50) {display photo1.jpg;}If this is your whole sketch though you are missing some stuff like:Code:#includeYourLibraryThatContainsDisplaysetup (){}loop () {}
 5 Using Arduino / General Electronics / Re: Best way to get a general electronics education. on: November 26, 2012, 10:18:15 pm Quote from: DVDdoug on November 26, 2012, 08:31:58 pmI'm not saying electronics trivial, but you don't need 2 or 3 years of electronics clases before you start having fun or doing useful things.    I think my microprocessor class was a 4th-year university class.   But, I was playing around with electricity and electronics in grade school (in the dark ages before microprocessors were invented).   I started-out with some grade-school science and a couple of "science fair" projects.  (I assume I knew Ohms' Law at the point, but I really don't remember when I learned Ohm's Law...) Then I built a couple of kits.  Maybe I was in Jr. high by the time I got a soldering iron and built my 1st kit.    I took an Electronics class when I was in my 2nd year of high school, and sometime during high school I started building stuff "from scratch".    Agreed. I don't have any college and i like to think i know a bit. Might not be able to recite formula's like i would if i had to cram them for a exam but i know where to find them and can usually put pieces together to make fun stuff happen. Find a project that uses the components you want to concentrate on learning at this point. Then get reading... followed by building. Fun times.
 6 Using Arduino / Project Guidance / Re: Arduino + Motor Shield. Old guy needs help. on: October 13, 2012, 08:03:30 pm Quote from: terryking228 on October 13, 2012, 07:45:41 pm@GoofBallTech: Exactly what library are you using?? ) I just googled the motor shield he was using and saw an entry on adafruit. It brought me here so i used that as the example code. http://www.ladyada.net/make/mshield/use.html
 7 Using Arduino / Motors, Mechanics, and Power / Re: Arduino strange behavior with dc motors on: October 13, 2012, 04:38:42 pm How do you have the ground tied together? If the ground from the 9V battery is tied to ground of the AA batteries then it would work ok for that. Once you connect USB to the board and power is then supplied from the PC it may not be enough to keep them properly referenced. This answer is also given from my understanding of your issue... perhaps a wiring diagram would help for me to better understand question if i did not interpret properly.
 8 Using Arduino / Project Guidance / Re: Arduino + Motor Shield. Old guy needs help. on: October 13, 2012, 03:36:44 pm To the point of speed, this would be one, of many possible, ways to do it. In this (untested) code your pot being in the center would stop motion. Go left and the motor goes one direction. Go right and the motor goes the other direction. The more you come from the center position the faster the motor will go. Code:// 10 bit input ranges 0 to 1023// 8 bit output ranges 0 to 255potVal = analogRead(potPin); // read the value from the potentiometer into potValif ( potVal > 520) {               // if pot is turned to the right  motor.setSpeed(map(potVal, 520, 1023, 0, 255));  // make the speed proportional to the amount of turn on the pot   motor.run(FORWARD); // set motor to move "forward"}else if (potVal < 504) {                // if pot is turned to the left  motor.setSpeed(map(potVal, 0, 504, 0, 255));  // make the speed proportional to the amount of turn of the pot  motor.run(BACKWARD);  // set motor to move "backward"}else {  // pot value must be between 504 and 520 which is our deadband  motor.run(RELEASE); // stop motor}
 9 Using Arduino / Project Guidance / Re: Make Own RC Boat Radio on: October 10, 2012, 09:54:33 pm I would say start small. Build projects that utilize the parts you will one day use in your boat. Once you know each piece well enough to use them in small groups and get the software working with multiple items at the same time.... then try to ball then all up and stick them in a hull. Crawl around a bit before you jump off a pier :-)It sounds like a very good final goal though. Something to work toward always helps keep you moving.
 10 Using Arduino / Project Guidance / Re: Arduino + Motor Shield. Old guy needs help. on: October 10, 2012, 09:49:50 pm Which motor shield you have?
 11 Using Arduino / Project Guidance / Re: Question about Controlling Solenoids with Relays!! on: October 08, 2012, 08:29:02 am Coil Specifications36.9mA @ 24VDCMin. Operating Voltage - 80% of the rated coil voltage (24 * .8 = 19vdc minimum voltage to coil)You cannot drive this coil directly from your arduino in any case. the rating for the above mentioned 2N3904 is 200ma (if memory serves) so it would drive this relay fine. Don't forget to research what resistor you need between the Arduino and the base of the transistor to avoid an over current situation on the output pin when driving the transistor.
 12 Using Arduino / Project Guidance / Re: Question about Controlling Solenoids with Relays!! on: October 07, 2012, 10:50:34 pm Quote from: retrolefty on October 07, 2012, 10:30:53 pmMore importantly this appears to be a 24 volt coil relay? Good catch, i looked right over that little bit of really important info.
 13 Using Arduino / Project Guidance / Re: Question about Controlling Solenoids with Relays!! on: October 07, 2012, 09:22:41 pm I don't see anything in that link for the current the coil pulls. A good items to use might be some 2N3904 transistors though. They are pretty cheap and easy to come by. Lots of examples on here about how to use them to control relays.
 14 Development / Other Hardware Development / Re: Arduino Pin Duplicator on: October 06, 2012, 11:41:42 pm I agree on the female header. Make it something like this motor shield....but that does look pretty cool.......
 15 Development / Other Software Development / Re: [MOD] Arduino Enhanced Release 1.0.1H for Windows (installer, drivers, etc) +SRC on: October 06, 2012, 11:18:15 pm Think there would be a way to invert colors? Editor background = #000000?Edit - Nevermind, i have discovered theme.txt. Veryyy niiiicee! Sexy black theme to go with all the new features.
 Pages: [1] 2 3 ... 12