Created
August 8, 2014 14:05
-
-
Save buildcircuit/01121a2f75ca13deec08 to your computer and use it in GitHub Desktop.
CD4094 experiment using Amarino shield. Get project details at: http://www.buildcircuit.com/amarino-shield-example-1-cd4094-control-with-arduino-basic-experiment-without-smart-phone/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Shift Out Data | |
* -------------- | |
* | |
* Shows a byte, stored in "dato" on a set of 8 LEDs | |
* | |
* (copyleft) 2005 K3, Malmo University | |
* @author: David Cuartielles, Marcus Hannerstig | |
* @hardware: David Cuartielles, Marcos Yarza | |
* @project: made for SMEE - Experiential Vehicles | |
*/ | |
int data = 8; | |
int strob = 7; | |
int clock = 10; | |
int oe = 9; | |
int count = 0; | |
int dato = 0; | |
void setup() | |
{ | |
Serial.begin(9600); | |
pinMode(data, OUTPUT); | |
pinMode(clock, OUTPUT); | |
pinMode(strob, OUTPUT); | |
pinMode(oe, OUTPUT); | |
} | |
void PulseClock(void) { | |
digitalWrite(clock, LOW); | |
delayMicroseconds(20); | |
digitalWrite(clock, HIGH); | |
delayMicroseconds(50); | |
digitalWrite(clock, LOW); | |
} | |
void loop() | |
{ | |
dato = 255; | |
for (count = 0; count < 8; count++) { | |
digitalWrite(data, dato & 01); | |
//serialWrite((dato & 01) + 48); | |
dato>>=1; | |
if (count == 7){ | |
digitalWrite(oe, LOW); | |
digitalWrite(strob, HIGH); | |
} | |
PulseClock(); | |
digitalWrite(oe, HIGH); | |
} | |
delayMicroseconds(20); | |
digitalWrite(strob, LOW); | |
delay(100); // waits for a moment | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment