numero uno
Member
Hello,
I have another problem with my teensy but this time it's related to shift registers. I am trying to do a small keyboard piano that has keys made of metal, and when you touch a key it makes a sound. That is the end goal, and it will be polyphonic. Right now, I am testing out shift registers so that I could use them to control many inputs, but my tests don't work. I have two 74hc595 in series and this is the code that I have uploaded to the teensy:
I believe that this code is supposed to count the LEDs in binary every half seccond, but it actually does nothing on the shift registers... I have enclosed some images of my setup, the LEDs just stay the same. By the way, I'm using 3.3v for the teensy and 5v for the shift registers/LEDs, and I have a biderectional logic level converter for the teensy to comunicate with the shift registers. The reason I dont use the same voltage everywhere is that I have some BC548B transistors that I plan on using for the key sensors, and I believe they only work on 5v. If you have an alternative transistor that works on 3.3v, please let me know.
I have another problem with my teensy but this time it's related to shift registers. I am trying to do a small keyboard piano that has keys made of metal, and when you touch a key it makes a sound. That is the end goal, and it will be polyphonic. Right now, I am testing out shift registers so that I could use them to control many inputs, but my tests don't work. I have two 74hc595 in series and this is the code that I have uploaded to the teensy:
Code:
//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 numberToDisplay = 0; numberToDisplay < 256; numberToDisplay++) {
// 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, numberToDisplay);
//take the latch pin high so the LEDs will light up:
digitalWrite(latchPin, HIGH);
// pause before next value:
delay(500);
}
}