Show Posts
Pages: [1] 2
1  Using Arduino / LEDs and Multiplexing / Re: 4x4x4 LED cube build on: January 18, 2013, 04:57:07 pm
sorry for the lack of posts, but most of my parts finally arrived today!! that's what i get for ordering them through china... at least my ebaybucks paid for them

anyways later tomorrow i will begin to construct my cube.
2  Using Arduino / LEDs and Multiplexing / Re: 4x4x4 LED cube build on: January 04, 2013, 05:06:29 pm
oooo i understand now, so in animations you can turn on the layers that are connected to the transistors. then the rest would connect straight to the arudino.
3  Using Arduino / LEDs and Multiplexing / Re: 4x4x4 LED cube build on: January 04, 2013, 04:10:00 pm
i completely forgot i needed transistors, but why do i need transistors? also this instructables looks like a good place to learn about 4x4x4 led cubes as it is exactly what I want to start off with.
http://www.instructables.com/id/4x4x4-LED-Cube-Arduino/
4  Using Arduino / LEDs and Multiplexing / Re: 4x4x4 LED cube build on: January 03, 2013, 04:09:48 pm
Ya that sounds good, should be pretty easy to switch to the shift registers. Is there a large difference in the brightness from the bottom led to the top led? Since I will only be using 16 resistors.

5  Using Arduino / LEDs and Multiplexing / 4x4x4 LED cube build on: January 03, 2013, 02:38:56 pm
hey everyone, ive decided i wanted to build a 4x4x4 cube to challenge my self.

components:
64 5mm blue diffused LEDS
connection wires
arduino UNO v3
craft wire
breadboard

most of these items are currently one their way and i want to get a head start on programming it.

my first question is which is easier on the programming side? a cube connect directly to arduino or a cube connected to shift registers and then arduino. i already have 4 74595 shift registers and would love to use them, but if the learning curve is too high i will jsut attempt them at a later time.
6  Using Arduino / Motors, Mechanics, and Power / good motors/gear box for use with tamiya tank on: January 01, 2013, 04:50:11 pm
ive decided to try and build a tank robot with my arduino UNO. after some research ive discovered that the tamiya twin motor gear box's motors are weird in the fact that they have a low voltage and high amps. so my question is what motors/gear box can i use with a basic motor shield like this one: https://www.adafruit.com/products/81 or this one: https://www.sparkfun.com/products/9815

i was trying to save a few bucks, but would it be better/ simpler to just buy the more expensive and correct shield?: http://www.robotshop.com/pololu-low-voltage-serial-controller-2.html
7  Using Arduino / Programming Questions / Re: Button state change help on: December 30, 2012, 08:09:02 pm
sorry for the confusion, as i am new and yes after reading those articles things are clearing up for me now.
8  Using Arduino / Programming Questions / Re: Button state change help on: December 29, 2012, 06:52:07 pm
how would i make the led blink, where in the code would i add the delay?
9  Using Arduino / Programming Questions / Re: Button state change help on: December 29, 2012, 05:47:26 pm
ok now i got it, for some reason i didnt have a delay at the end of the code and my led was acting up, but with a delay(100) its turning on every two clicks.
10  Using Arduino / Programming Questions / Re: Button state change help on: December 29, 2012, 05:20:47 pm
The ++ is how C increments a variable- read about it here, so buttonPushCounter++; just increases the count by one.

Then the lines  Serial.println("on"); and Serial.print("number of button pushes:  "); print the text in quotes to the monitor.

Lastly, the line Serial.println(buttonPushCounter); prints the value of the counter (it has no quotes, so it sends the value, not the actual words).

The % function is called the modulo, read about it here. It returns the remainder when the first number is divided by the second. The sketch wants the led to go on every 4 clicks, so it looks for the remainder of when the counter is divided by 4. If the remainder is 0, then the counter is on 4, 8, 12 etc and so there have been 4 clicks and the led goes on. If it was on say 2 clicks, the remainder would be 2, or if it was on say 15 clicks the remainder would be 3 and so is not a multiple of 4 and the led should not be switched on.


so serial.print is just sending data to lets say a 16x2 lcd screen? also if i wanted to make the led turn on every 2 clicks the function would be (buttonPushCounter% 2==0 )??
11  Using Arduino / Programming Questions / Re: Button state change help on: December 28, 2012, 11:36:15 pm
then all this id just taking about the button counter? 
       
      buttonPushCounter++;
      Serial.println("on");
      Serial.print("number of button pushes:  ");
      Serial.println(buttonPushCounter);

also it explains that this function is the remainer of the division of two numbers, could someone clarify this?  if (buttonPushCounter % 4 == 0)
12  Using Arduino / Programming Questions / Re: Button state change help on: December 28, 2012, 11:10:38 pm
im sorry i wrote that wrong i understand what button state normall means but what does if (buttonState != lastButtonState)
13  Using Arduino / Programming Questions / Button state change help on: December 28, 2012, 10:17:13 pm
im trying to understand how to work with a button. i want an led to turn on after one press and remain one untill i press the button again.

here is a button state change code but im having issues understanding parts of it. could someone explain what buttonstate!+lastbuttonstate and

what these mean: buttonPushCounter++;
      Serial.println("on");
      Serial.print("number of button pushes:  ");
      Serial.println(buttonPushCounter);

Code:
/*
  State change detection (edge detection)
    
 Often, you don't need to know the state of a digital input all the time,
 but you just need to know when the input changes from one state to another.
 For example, you want to know when a button goes from OFF to ON.  This is called
 state change detection, or edge detection.
 
 This example shows how to detect when a button or button changes from off to on
 and on to off.
    
 The circuit:
 * pushbutton attached to pin 2 from +5V
 * 10K resistor attached to pin 2 from ground
 * LED attached from pin 13 to ground (or use the built-in LED on
   most Arduino boards)
 
 created  27 Sep 2005
 modified 30 Aug 2011
 by Tom Igoe

This example code is in the public domain.
    
 http://arduino.cc/en/Tutorial/ButtonStateChange
 
 */

// this constant won't change:
const int  buttonPin = 2;    // the pin that the pushbutton is attached to
const int ledPin = 13;       // the pin that the LED is attached to

// Variables will change:
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button

void setup() {
  // initialize the button pin as a input:
  pinMode(buttonPin, INPUT);
  // initialize the LED as an output:
  pinMode(ledPin, OUTPUT);
  // initialize serial communication:
  Serial.begin(9600);
}


void loop() {
  // read the pushbutton input pin:
  buttonState = digitalRead(buttonPin);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
      // if the current state is HIGH then the button
      // wend from off to on:
      buttonPushCounter++;
      Serial.println("on");
      Serial.print("number of button pushes:  ");
      Serial.println(buttonPushCounter);
    }
    else {
      // if the current state is LOW then the button
      // wend from on to off:
      Serial.println("off");
    }
  }
  // save the current state as the last state,
  //for next time through the loop
  lastButtonState = buttonState;

  
  // turns on the LED every four button pushes by
  // checking the modulo of the button push counter.
  // the modulo function gives you the remainder of
  // the division of two numbers:
  if (buttonPushCounter % 4 == 0) {
    digitalWrite(ledPin, HIGH);
  } else {
   digitalWrite(ledPin, LOW);
  }
  
}

Moderator edit: [code] [/code] tags added.
14  Using Arduino / Programming Questions / Re: help with 74HC595 controlling induvial leds on: December 27, 2012, 09:08:42 pm
Do I need the what?
15  Using Arduino / Programming Questions / Re: help with 74HC595 controlling induvial leds on: December 27, 2012, 04:11:51 pm
ok i think i get it now. using this code i was able to turn one leds and make them flash at different intervals.

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;



void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  // count from 0 to 255 and display the number
  // on the LEDs
  for (int i = 0;i < 256; i++) {
    // take the latchPin low so
    // the LEDs don't change while you're sending in bits:
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin,clockPin, MSBFIRST, B01000000); 
   //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    delay(500);
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin,clockPin,MSBFIRST, B00000001);
    digitalWrite(latchPin, HIGH);
    delay(200);
    digitalWrite(latchPin,LOW);
    shiftOut(dataPin,clockPin,MSBFIRST,B00000100);
    digitalWrite(latchPin, HIGH);
  delay(500);

}} 
 

 
 
Pages: [1] 2