Show Posts
Pages: 1 [2] 3 4 ... 35
16  Forum 2005-2010 (read only) / Troubleshooting / Re: potentiometer's to control awsomness! on: December 15, 2007, 01:09:06 pm
lol sorry but i gotta throw a noob question at you.... whats IDE?

sorry, uve been telling me to go there for a while and i'm like "hmm, maybe its the tut section? "
17  Forum 2005-2010 (read only) / Troubleshooting / Re: potentiometer's to control awsomness! on: December 14, 2007, 06:50:23 pm
this gives me 3 modes right?

0, 1, 2?

cuz if thats the code for mode changing, i think i might be able to code the rest myself, wait except brightness, and controlling it with the potentiometer... can u code that also please?
thanks mem!
big93
18  Forum 2005-2010 (read only) / Troubleshooting / potentiometer's to control awsomness! on: December 14, 2007, 02:00:25 pm
i have an idea, and it'll be awsome!! heres what the situation is: we have 2 potentiometers, and 3 leds (RGB) and a 7 segment display. so we could do this: we can use one potentiometer  to control the mode ( either mode 1:led 1, mode 2:led 2, or mode 3:led3 ) and use the second potentiometer to controll the brightness of each led, and put em all in pwm obviously. And use the 7 segment display to tell us what mode were in.

so we turn one potentiometer, and itll tell us which led were controling, and then we use the second potentiometer to tell us the birghtness of the led's, and the mode is displayed on the 7 segment display.
but i need somebody who can code this up for me, cuz i think i can only code the 7 seg display, so any one up for the challenge??
thanks in advance!
-big93
19  Forum 2005-2010 (read only) / Troubleshooting / Re: using a mini keypad password on: December 14, 2007, 06:55:12 pm
thanks, i WILL get that book, but when talking about c, is c altered to enable these commands for arduino, or for example, could you rename that book to "Arduino programming code" and not change a thing in the book?

what i mean is: will the book exactly tell me how to program c for arduino ( becuase it's not altered for diffrent programs ) or is it slightly changed for each type of program used?

o yea, and what edition of the book do i need? i see 1, 2, and 3 ( or does edition not even matter? )
i think second edition has ansi standard...

edit:

lol i got the book already, but my person who controlls me ( aka parent ) wants to know if the microsoft step by step c tutorial book is better then this, and if i should get that instead

p.s, it sais "some" knowledge of things like variables, loops and some other stuff is needed, do i qualify for knowing that stuff. To be more accurate, it sais i need to know "variables, assignment statements, loops and functions", do i know these already?
thnks
-big94-1
20  Forum 2005-2010 (read only) / Troubleshooting / Re: using a mini keypad password on: December 13, 2007, 09:01:49 pm
glad u had a great plane ride, i also had a great time ( shoveling the snow outa my driveway, while waving to your plane flying over me! lol, i am the east coast )

but yea, it seems very complicated in which how c is done, and every time i look at a new code i'm like "wtf, i dident know i could do that!!!" and then me writing 700 lines makes me feel angry that it could have been done in 3 lines lol

so just to be clear, i can make an array, lets say i just want to call pins 0-8 pin ( and then 1-8 )

then i have to put:
int pin[] = {0,1,2,3,4,5,6,7,8}

and it will all be called pin0 pin1 pin2 pin3 pin4..... right?
21  Forum 2005-2010 (read only) / Troubleshooting / Re: using a mini keypad password on: December 13, 2007, 02:49:07 pm
thanks! have a good flight ( u prob wont read this till u get back lol ), but ill try it and post back in a bit with what i did ( or tried ) to do lol
22  Forum 2005-2010 (read only) / Troubleshooting / Re: using a mini keypad password on: December 12, 2007, 08:09:23 pm
wow, that code looks great, thanks! i'm fixing it up right now, but 1 quick question,

when you put the pin numbers where i will be attaching the code, if i want to put more then one, i do what you did right, i do this {1,2,3} and that lets me add a cuple instead of adding them 1 at a time, but how do i differentiate between the int name?
becuase if i have

int blabla = {2,3,4}

then what is pin 2 called?
and what is pin 3, 4 called? are they called blabla2, blabla3, blabla4?

it's tellingmy the the invalid passcode line wasnot delared in the scope! was i sapposed to add it manually? and what is it sapposed to equal number wize, 0?


lol sorry, i'm really bad at coding, i really dont get how to get this code workin, even though, i do understand the code in general.

heres what i have so far, ill show you the code and i'll tell you exactly what my hardware is:

Code:
 #define   PASSCODE_LEN  3    // number of presses required
  int buttonPins[] = {2,3,4};  // pins connected to buttons: 0 & 1 are the serial port so lets start from 2
  int passcode[PASSCODE_LEN] = {2,0,1};    // the correct sequence of buttons (in this example, btn 0 -> pin2, btn 1->3, btn 2 ->4)
  int hitCount = 0;            // nbr of correct button presses
  int buzzer = 7;
void setup(){
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);

}

void loop(){

    for(int btn = 0; btn < 3; btn++){
         if(  digitalRead(buttonPins[btn]) == HIGH)
               if( btn == passcode[hitCount] ){   // was the expected button pressed
                   hitCount++;            // yes, increment the count
                   if( hitCount == PASSCODE_LEN){  // got all our presses?
                       passcodeValid(buzzer, HIGH); // yes, call function to handle valid passcode sequence                                      
                       // you may want to reset the hitCount here to wait for another entry
                   }                                          
               }
               else{      // here if an incorrect button was pressed
                  hitCount = 0;         // reset the count
                  passcodeInvalid() // function to handle invalid sequence
               }                      
        
    }  
}
 

and it keeps yellin at me that passcodevalid is not in the scope, and i'm pretty sure it will tell me that the passcodeinvalid will aslo not be in the code.

hardware wise, i have 3 buttons connected to pins 2,3,4 and 7 for the buzzer, and ofcourse ground. and thats it, i'm sorry i cant even figure out how to put the rest of the code together, i thought that i really could... but thanks for showin me, i rly appreciate it.
23  Forum 2005-2010 (read only) / Troubleshooting / using a mini keypad password on: December 12, 2007, 05:14:54 pm
i have like 3 buttons, and i want to pragram them to be clicked in a certain order, and if that order is correct, then i want the buzzer to god off, or an led lights up, i have a "pre" code, but i cant get it working. I got this code from a guy, and i had to edit it to use it with switches, so i probably messed it up, here, take a gander:


/*
 * Turn an led on when a special sequence of characters
 * (a password) is sent over the serial connection.
 */
int buzzer = 3;        // buzzer for wrong answer
int ledPin = 10;       // the led is hoooked up to this pin
int passChar1 = 1;   // the first character of the password
int passChar2 = 2;   // the second character of the password
int passChar3 = 3;   // the third character of the password
int nextChar;
int charCount;

void setup() {

  pinMode(ledPin, OUTPUT);
  pinMode(passChar1, INPUT);
  pinMode(passChar2, INPUT);
  pinMode(passChar3, INPUT);
  digitalWrite(ledPin, LOW);
  charCount = 0;
  pinMode(buzzer, OUTPUT);
}

void loop(){
{
    nextChar = Serial.read();
  
  
    if (charCount == 0) {
      // check for the first char of the pwd...
      if (nextChar == passChar1) {
        charCount = 1;  // got it, so update the character counter
      } else {
        charCount = 0;  // wrong character, so reset count to zero
      }
    }
    else if (charCount == 1) {
      // check for the second char of the pwd...
      if (nextChar == passChar2) {
        charCount = 2; // got it, so update the character counter
      } else {
        charCount = 0; // wrong character, so reset count to zero
      }
    }
    else if (charCount == 2) {
      // etc.
      if (nextChar == passChar3) {
        charCount = 3;
      } else {
        charCount = 0;
      }
  
    // has complete password been entered yet?
    if (charCount == 3) {
      
        // led on
        digitalWrite(ledPin, HIGH);
        charCount = 0;
     }
     else if (charCount == 0) {
       // count was set to zero, meaning a bad char was received.
      
        // blink the led
        digitalWrite(buzzer, HIGH);
        delay(1000);
        digitalWrite(buzzer, LOW);
        delay(10);
    }
  }

  }}



see if you guys can tell me whats wrong, or how to fix it, and to make life esier, lets use an led instead of a buzzer, cuz if a buzzer sais your right, it's annoying!


p.s how do i add the code box thing, i looked allover the page here, and i dont see it...
thnks in advance
-big92+1
24  Forum 2005-2010 (read only) / Troubleshooting / Re: using the "if" statement on: December 11, 2007, 07:23:53 pm
looks slightly simple lol, and to implement it into my code, i just copy and paste it into my code, or do i have to merge it with my code, like add all the int's  to before void setup?

sry, i'm really new, and i cudent evan get the piezo melody thing to work on the tutorial place...
25  Forum 2005-2010 (read only) / Troubleshooting / Re: using the "if" statement on: December 10, 2007, 11:42:09 pm
thanks alot guys, i was looking at the refrence page and it just dident give me what i was looking for, but you guys showed it to me, so thanks alot!!!

hmm, the piezo is acting strange, its leaving the light on, and the piezo is over 30 in the serial port, which idk why its like pure silence, and when i speak right into the speaker when its zero, nothing happens, but i did get some feedback when i tapped it when it finally zeroed out...

any way to smothen it out to make it more calm?
26  Forum 2005-2010 (read only) / Troubleshooting / using the "if" statement on: December 09, 2007, 10:34:36 pm
rawr!! i looked at the refrence and i tried to set up a working code using if statement, but it's not working, look at the code and tell me whats wrong please

int val = 0;

void setup() {
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  (13, OUTPUT);
}
void loop() {
  val = analogRead(0);
  if (val > 50 )
  (13, HIGH);
   Serial.println(val);
}

thats the code....

i have an led connected to pin 13, and i have a piezo connected to analog 0, and i'm trying to make it so when the led sees that the number from the piezo is greater then 50, to light up, and when its less then 50, to turn off, but i cant get it to turn on in the first place so i dident even script the less then intiger...

p.s : i really dont get the piezo, i see randome numbers come in from the serial port, and they dont even seem to be based on the noises i make, is it becuase i coded the piezo wrong??

thanks in advance
-big93
27  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Ip Logged > Why? on: June 04, 2008, 09:24:30 pm
but does it really log your ip?
28  Forum 2005-2010 (read only) / Syntax & Programs / Re: simple pwm on/off code on: August 25, 2010, 08:27:29 pm
thank you, i think that the array tid bit is vital to what i need, much appreciated!
29  Forum 2005-2010 (read only) / Syntax & Programs / simple pwm on/off code on: August 24, 2010, 03:10:05 am
I'm somewhat of an amateur, and im looking just to be pointed in the right direction. I have an idea for a code to write to control all 6 pwm pins and basically make an array of led's that turn on slowly in a row.

I plan to make it into a circle, so i want a continuous array of led's turning on and off slowly after one another, but i want each led to start turning on BEFORE the led before is completely off to make a trailing effect.

I'm sure i could make the code myself but it will be extremely long and complicated. I'm sure there are better ways to go about doing what i want to do. Like i said i don't want(or expect ) the code to be handed to me, i just  want a hand in the right direction as to what commands i should be using and if i don't know of them ill research.

Also, i'm not sure how to re-map the numbers to make a better flow, because the pwm pins are 3,5,6,9,10,11... It would be easier if they could be re-numbered into 1-6 so that i could name a variable numbered 1-6 ) when using digitalwrite rather then making six different variables which im guessing will lengthen and complicate my code as well.


Thanks for any help!
30  Forum 2005-2010 (read only) / Syntax & Programs / Re: sparkfun button pads... again... on: February 27, 2009, 05:34:26 pm
any ideas halley?
Pages: 1 [2] 3 4 ... 35