Show Posts
Pages: 1 2 3 [4] 5 6 7
46  Forum 2005-2010 (read only) / Syntax & Programs / Re: 74HC595 lag using pushbutton as inputs on: April 16, 2010, 08:25:44 am
i also noticed on the shiftout tutorial there is a 0.1"f capacitor on data pin
47  Forum 2005-2010 (read only) / Syntax & Programs / Re: 74HC595 lag using pushbutton as inputs on: April 16, 2010, 07:42:41 am
here is the breadboard layout
48  Forum 2005-2010 (read only) / Syntax & Programs / Re: 74HC595 lag using pushbutton as inputs on: April 16, 2010, 05:43:41 am
hmm.
i have done previous circuits with pull ups, and pull downs. and was using mini push buttons

in this case i was attempting with arcade type buttons (only 2 wires signal and ground)

i will try with a pullup


that being said. the problem isn;t on press.
on press it lights up right away. it's the turning off (releasing button)

but nothing that could cause lag in the code right?
49  Forum 2005-2010 (read only) / Syntax & Programs / 74HC595 lag using pushbutton as inputs on: April 15, 2010, 03:26:42 pm
hi all
first time poster so bare with me

i am having some severe lag issues with the 74HC595, perhaps it is in my code

what i am attempting to do. using 74HC595 to put out appropriate pin
and light 3x common cathode RGB LED based on button combo

picture 3 buttons
push any single button and you get the corresponding blue
push any combination of 2 and you get corresponding green
push all three you get corresponding red

i am able to run pattern and it executes the loop successfully and precisely

the problem i encounter is with the push buttons
when i loop through the digitalRead for the three buttons
i have assigned values to the button to correspond with the output array index

ie: button 1 = 1, button 2 = 2, button 3 = 4
button 1 = index 1
button 2 = index 2
button 1 + 2 = index 3
button 3 = index 4
button 1 + 3 = index 5
button 2 + 3 = index 6
button 1 + 2 + 3 = index 7

anyway, see the code below for reference

the pattern() methods executes fine
the input() and lights() methods provide me with sever lag
meaning i press button 1, and the blue LED lights up instantaiously, but then takes about a second to turn off!?!?!?

any help and advice would be welcome!


Code:
//these are for the shift register
/*

Q1 -| U |- VCC
Q2 -|   |- Q0
Q3 -|   |- DS
Q4 -|   |- OE
Q5 -|   |- ST
Q6 -|   |- SH
Q7 -|   |- MR
GD -|   |- Q7'

*/
#define LATCH_PIN 11 //Pin connected to ST_CP 74HC595
#define CLOCK_PIN 12 //Pin connected to SH_CP 74HC595
#define DATA_PIN 10  //Pin connected to DS of 74HC595

// pattern test
int counter = 0;
int powerup = 0;

/*
  L = 1
  M = 2
  H = 4
  
  L + M = 1 + 2 = 3
  L + H = 1 + 4 = 5
  M + H = 2 + 4 = 6
  L + M + H = 1 + 2 + 4 = 7
*/

int output[8] = {
  B00000000, // OFF
  B10000000, // L
  B00100000, // M
  B01010000, // L + M
  B00001000, // H
  B01000100, // L + H
  B00010100, // M + H
  B00000010  // L + M + H  
};

// pins
int buttonPins[3] = {2,3,4};
int buttonIndex  = 0;
int values[3] = {1,2,4};

void setup()
{
  //shift register pins are output.
  pinMode(LATCH_PIN, OUTPUT);
  pinMode(CLOCK_PIN, OUTPUT);
  pinMode(DATA_PIN, OUTPUT);
  
  //initiate pins as input
  for(int n = 0; n < 3; n++)
  {
    pinMode(buttonPins[n], INPUT);
  }
}

void loop()
{
  if(powerup == 0){pattern();}
  input();
}

void input()
{
  // reset index values
  buttonIndex = 0;
  
  // read button states
  for(int n = 0; n < 3; n++)
  {
    buttonIndex += digitalRead(buttonPins[n]) == 1 ? values[n] : 0;
  }
  
  lights();
}

void lights()
{
  digitalWrite(LATCH_PIN, LOW);
  shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, output[buttonIndex]);
  digitalWrite(LATCH_PIN, HIGH);  
  digitalWrite(LATCH_PIN, LOW);  
}

void pattern()
{
  digitalWrite(LATCH_PIN, LOW);
  shiftOut(DATA_PIN, CLOCK_PIN,MSBFIRST, output[counter]);
  digitalWrite(LATCH_PIN, HIGH);  
  
  counter++;
  if (counter > 8)
  {
    counter = 0;
    powerup = 1;
    digitalWrite(LATCH_PIN, LOW);    
    shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, output[0]);
    digitalWrite(LATCH_PIN, HIGH);    
  }
  delay(250);
}
50  Forum 2005-2010 (read only) / Interfacing / Hex Color Value to RGB array help on: January 20, 2011, 12:48:48 pm
hey all
i have search long and hard for a quick solution to a hex to array convertor,
strol() just hasen't provided the intended result, or maybe i am doing it wrong.

what i need is an array representation of a converted hex number:

pseudo

hexToArray(hex)
{
   ...
   return array;
}

array = hexToArray("FFFFFF"); // this should yeild (255,255,255);
51  Forum 2005-2010 (read only) / Interfacing / Re: Upload Sketch from Processing? on: November 05, 2010, 07:43:10 am
Thanks Andy R

So my understanding then is from processing you can only pass variables that arduino needs to absorb and determine actions.
There is no way to call methods directly then? Would be a nice to have feature i guess, but the variable passing is acceptable.

52  Forum 2005-2010 (read only) / Interfacing / Re: Upload Sketch from Processing? on: November 01, 2010, 11:05:24 am
any thought?
53  Forum 2005-2010 (read only) / Interfacing / Re: Upload Sketch from Processing? on: October 26, 2010, 05:34:20 am
let me clarify

the though was for processing to do some variable and config stuff.
then using the arduino.cc class and firmata on the chip be able to upload a sketch to processing.

with the answer provided above. a different approach is required.

I have played around with a blink on roll over sketch using processing and firmata to set HIGH or LOW the pin 13 LED.
In all the reference to the arduino library for processing i have not seen any instance where i can call a method that i have create on the arduino side.

let me describe

Arduino
Code:
// firmata included
void setup(){}
void loop(){}
void customMethod(){}

Processing
Code:
/*
 some code ommited
*/
import processing.serial.*;
import cc.arduino.*;

Serial port;
Arduino arduino;

void setup()
{
   arduino = new Arduino(this, Arduino.list()[0], 57600);
}

void draw()
{
  background(#000000);
  fill(#000000);
  rect(0,0,200,200);
}

void mousePressed()
{
  /*
    i want to fire off a method called customMethod in the arduino code
    this doesn't work
  */

   arduino.customMethod();
}




This is the snippet i would like to work

void mousePressed()
{
  /*
    i want to fire off a method called customMethod in the arduino code
    this doesn't work
  */

   arduino.customMethod();
}


can this be done?
54  Forum 2005-2010 (read only) / Interfacing / Upload Sketch from Processing? on: October 25, 2010, 07:06:10 pm
Is it possible to upload a sketch via processing?
55  Forum 2005-2010 (read only) / Interfacing / Re: webpage ethernetshield blank with IE ?? on: October 26, 2010, 05:51:14 am
Code:
client.print("<META HTTP-EQUIV=REFRESH content=5 url='http;//192.168.1.110' >");

replace the ; with a :
client.print("<META HTTP-EQUIV=REFRESH content=5 url='http://192.168.1.110' >");
56  Forum 2005-2010 (read only) / Development / Re: RGB LED STRIP on: September 14, 2010, 10:34:28 am
[media]http://www.youtube.com/watch?v=ivobJ14zTSo[/media]
57  Forum 2005-2010 (read only) / Development / Re: Need quick review before board house on: May 19, 2010, 10:08:58 am
for this size of board you can easily use only 1 mounting screw
58  Forum 2005-2010 (read only) / Development / Re: Not a new development, just a board (bored) mod on: May 18, 2010, 12:36:40 pm
great write up mowcius!
great site as well http://www.duinoaday.co.uk/ <- bookmarked
my apologies for providing a how to smd list. didn't realize you already knew how! smiley-wink
59  Forum 2005-2010 (read only) / Development / Re: Not a new development, just a board (bored) mod on: May 18, 2010, 12:24:47 pm
for getting the old SMD LEDs off, or any SMD 0805 things like resistors and diodes i would recommend getting a pair of hot tweezers.
they are pretty easy to solder on.

1. clean the pads
2. use flux on both pads
3. put a very small amount of solder on one pad
4. grab the SMD with needle tweezers
5. align it on the pads
6. heat the pad you presoldered in step 3 and slip the SMD in
7. solder the other side
8. enjoy the fruits and colors of your labor

SMD can go on perfboards as well!


and they are dirt cheap if you buy in bulk from ebay
i bought a 100pcs mix pack (white, yellow, purple, cyan, red, green, blue)
60  Forum 2005-2010 (read only) / Development / Not a new development, just a board (bored) mod on: May 18, 2010, 09:35:19 am
Hey all
This isn't anything super duper fantastic.

but last night, i finished soldering up one of my projects and had some 0805 LEDs left over...   ...so i decided to change the lights on my Arduino board

Power = Blue
Pin 13 = Blue
TX = Green
RX = Red

enjoy
[media]http://www.youtube.com/watch?v=Yy7pw4au2cw[/media]
Pages: 1 2 3 [4] 5 6 7