Arduino Uno and CD4094 [Solved]
i´m having trouble arduino uno , 16-bit shift register made out of 2 cd4094´s.
the program appears working, leds connected on outputs of shift registers nothing. doing wrong ?
the program appears working, leds connected on outputs of shift registers nothing. doing wrong ?
code: [select]
#include <avr/pgmspace.h>
#include <spi.h>
const int latchpin = 10; //pin connected str(pin 1) of hef4094
//clock = 13, mosi = 11
const int eprom[12] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800};
int address = 0;
byte = 0;
void setup() {
// put setup code here, run once:
pinmode(latchpin, output);
digitalwrite(latchpin, low);
spi.begintransaction(spisettings(500000, lsbfirst, spi_mode0)); // initialize spi
serial.begin(9600);
}
void loop() {
// put main code here, run repeatedly:
address = eprom[i];
serial.print(i);
serial.print(" ");
serial.println(address, hex);
serial.println(" ");
addressout(address % 256, address / 256);
delay(1000);
i++;
if(i > 11) = 0;
}
void addressout(byte addresslow, byte addresshigh)
{
digitalwrite(latchpin, high);
spi.transfer(addresslow);
spi.transfer(addresshigh);
//delay(1);
digitalwrite(latchpin, low);
}
did try code 1 shift register, first? know leds connected correctly?
Arduino Forum > Using Arduino > Programming Questions > Arduino Uno and CD4094 [Solved]
arduino
Comments
Post a Comment