First steps with Processing and Arduino (controlling shift register from computer)

First steps with Processing and Arduino (controlling shift register from computer)

Show All Items

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

Show All Items

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:

  • First steps with Processing and Arduino (controlling shift register from computer)

    Processing_shiftregister_by_qu4l1ty.txt

Step 2: Arduino code

First steps with Processing and Arduino (controlling shift register from computer)

Show All Items

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

First steps with Processing and Arduino (controlling shift register from computer)

Show All Items

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

arduino – First steps with Processing and Arduino (controlling shift register from computer), in category: technology