Introduction: First Steps With Processing and Arduino (controlling Shift Register From Computer)

Picture of First Steps With Processing and Arduino (controlling Shift Register From Computer)

Hey again! I have just a few parts, so i decided to start building virtual! I had processing on my computer, but i had never used it, because i´m just a student and i don´t know Java at all. First i decided to draw square. I had soo much problems with it, but i finally made it! I got black square to my screen! It was pretty funny, because i don´t usually "celebrate" this primitive things.

Now i´m showing you how to build application that can control shift register with Processing and Arduino!

Btw you can find processing from here:

https://processing.org/

Step 1: Processing Coding

Okay. Now i´m showing how to use processing to create squares, text and send clicks to Arduino. I have made this code earlier today, and i didn´t record it. I hope you get something of that video, because i can´t explain anything what i´m doing in processing.

14.12.2015:

Oh shit... I forgot to give you the processing code! Sorry about that! Here you go:

Step 2: Arduino Code

Picture of Arduino Code

Okay. Now we have code in processing, so next thing we do is creating Arduino code.

I´m not making video about it, but i´m pasting the code right here:

===================================================================================

int dataPin = 3; //dataPin = 3

int clockPin = 4; //clockPin = 4

int latchPin = 5; //latchPin = 5

int value = 0;

void setup() {

pinMode(dataPin, OUTPUT); //put dataPin to output pin

pinMode(latchPin, OUTPUT); //put latchPin to output pin

pinMode(clockPin, OUTPUT); //put clockPin to output pin

Serial.begin(9600); // start serial communication, speed is 9600 baud

}

void loop() {

if(Serial.available() > 0) { //if we got some data

value = Serial.read(); //store data to value

}

digitalWrite(latchPin, LOW); //put latch LOW, so we can´t see flickering

shiftOut(dataPin, clockPin, MSBFIRST, value); //shift value out to the shiftregister

digitalWrite(latchPin, HIGH); //put latch back on, so we can see the leds

}

Step 3: Building Hardware

Picture of Building Hardware

Now we have to build it up. I used in this project Texas Intrument´s HC74595N shift register.

There you can find good tutorial about hc595:

https://www.arduino.cc/en/Tutorial/ShiftOut

Now we are ready. You can check my video about this project, but i embed it to introducion(or first step).

https://www.youtube.com/watch?v=goJxiGnAH88

Comments

About This Instructable

689views

10favorites

License:

More by Qu4l1ty:DIY RTC (i2c) DS1307Cheap 7 segment clock (cardboard clock)Arduino Virtual Data (in This Example Clock) With Processing
Add instructable to: