From 7f72638f02759decb1e6e6404f15d475646ceec6 Mon Sep 17 00:00:00 2001 From: Haruna <macuser@Mac-no-MBP.eduroam.student> Date: Wed, 25 Apr 2018 11:57:27 +0100 Subject: [PATCH] added new files --- RunOnArduino/RunOnArduino.ino | 30 ++++++++++++++++++++++++++++++ cam/cam.pde | 23 +++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 RunOnArduino/RunOnArduino.ino create mode 100644 cam/cam.pde diff --git a/RunOnArduino/RunOnArduino.ino b/RunOnArduino/RunOnArduino.ino new file mode 100644 index 0000000..04ccaee --- /dev/null +++ b/RunOnArduino/RunOnArduino.ino @@ -0,0 +1,30 @@ +// Code originally from http://www.instructables.com/id/Arduino-to-Processing-Serial-Communication-withou/ +// by https://www.instructables.com/member/thelostspore/ +// Code was shared under public domain https://creativecommons.org/licenses/publicdomain/ + +// This code reads analog inputs from pins A0 and A1 and sends these values out via serial +// You can add or remove pins to read from, but be sure they are separated by commas, and print a +// newline character at the end of each loop() + +int AnalogPin0 = A0; //Declare an integer variable, hooked up to analog pin 0 +int AnalogPin1 = A1; //Declare an integer variable, hooked up to analog pin 1 + +void setup() { + Serial.begin(9600); //Begin Serial Communication with a baud rate of 9600 +} + +void loop() { + //New variables are declared to store the readings of the respective pins + int Value1 = analogRead(AnalogPin0); + int Value2 = analogRead(AnalogPin1); + + /*The Serial.print() function does not execute a "return" or a space + Also, the "," character is essential for parsing the values, + The comma is not necessary after the last variable.*/ + + Serial.print(Value1, DEC); + Serial.print(","); + Serial.print(Value2, DEC); + Serial.println(); + //delay(500); // For illustration purposes only. This will slow down your program if not removed +} diff --git a/cam/cam.pde b/cam/cam.pde new file mode 100644 index 0000000..bf6e3f2 --- /dev/null +++ b/cam/cam.pde @@ -0,0 +1,23 @@ +import processing.video.*; + +Capture cam; + +void setup(){ +size(64,32); +println(Capture.list());// 320x180 fps=30 + +cam= new Capture(this, 1280, 720, 30); +cam.start(); +} + +void draw(){ +if(cam.available()){ +cam.read(); + +tint(255,20); +} + +//scale(2.0); +image(cam, 0,0, width, height); + +} \ No newline at end of file -- GitLab