Uploaded by 7Ds7 on Aug 22, 2009
This is one attempt to recreate the old Magic Draw Board game using the Arduino Board to communicate with Processing through the serial port.
It was based on the patternt.pde bundled with the Processing application.
Hardware you need:
1 Arduino Board
2 Potentiometers
1 Pressure Buttoon
Wires
Software you need:
Arduino Enviroment
Processing Enviroment
Instructions:
Connect the X axis potentiometer to PinAnalog 2, Voltage to 5v and Ground
Connect the Y axis potentiometer to PinAnalog 5, Voltage to 3V and Ground
Connect the Button to PinDigital 0 and Ground
Software:
/*******Use This For Arduino*******/
/**
* SandGameMod.
* Arduino
* DS modded thingy
*
*/
int potPinx = 2;
int valuex = 0;
int potPiny = 5;
int valuey = 0;
int buttonPin = 0;
int val = 0;
void setup() {
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}
void loop() {
valuex = (analogRead(potPinx)); if(valuex(INSERT BIGGER SIGN HERE)0){ Serial.print(valuex); }
Serial.print(","); valuey = (analogRead(potPiny)); if(valuey(INSERT BIGGER SIGN HERE)0){ Serial.print(valuey);
}
Serial.print(",");
val = digitalRead(buttonPin);
if (val == HIGH) { Serial.print("0"); } else {
Serial.print("1");
}
Serial.print(",x");
delay(20);
}
/*******************************/
/*******Use This For Processing*******/
/**
* SandGameMod.
* Processing
* DS modded thingy
*
*/
import processing.serial.*;
Serial myPort;
String myString = null;
float convx;
int conv2x;
int pconvx;
float convy;
int conv2y;
int pconvy;
float convb;
int conv2b;
void setup()
{
size(1024, 680);
myPort = new Serial(this, Serial.list()[1], 9600);
myPort.clear();
myString = myPort.readStringUntil(120);
myString = null;
background(102);
smooth();
}
void draw()
{
pconvx=conv2x;
pconvy=conv2y;
myString = myPort.readStringUntil(120); if (myString != null) { println(myString); String[] stri= split(myString, ',');; println(stri); convx=float (stri[0]); conv2x=int(convx); convy=float (stri[1]); conv2y=int(convy); convb=float (stri[2]); conv2b=int(convb); println(conv2b); if (conv2b==1){ background(random(256),random(256),random(256)); }
}
variableEllipse(conv2x, conv2y, pconvx, pconvy);
variableEllipse2(conv2x, conv2y, pconvx, pconvy);
}
void variableEllipse(int x, int y, int px, int py)
{
float speed = abs(x-px) + abs(y-py);
stroke(speed);
ellipse(x, y, speed, speed);
fill(random(256),random(256),random(256));
}
void variableEllipse2(int x, int y, int px, int py)
{
float speed = abs(x-px) + abs(y-py);
stroke(speed);
ellipse(x, y, speed-10, speed-10);
fill(random(256),random(256),random(256));
}
/*******************************/
Category:
Tags:
License:
Standard YouTube License
-
3 likes, 0 dislikes
-
Artist: Various
5:24
Arduino & xbee tutorial - transmit from seperate arduino wirelessly to pc or macby roboteernat20,171 views
1:10
arduino tutorial 3 - potentiometerby RedFrogRising7,894 views
4:04
Arduino and electret microphone to processingby joselozanogranes13,490 views
8:51
Arduino Breadboard Tutorial -Arduino Workshop Project Video #1by Halo2maniaccc87,600 views
0:31
Example 29.1by tronixstuff7,602 views
5:26
Arduino Tutorialby treasonx8,705 views
4:46
MMA7260q + Arduino + Processingby iAmTr3s5,434 views
3:17
Arduino Tutorial #1 - The Blinkby guci229,978 views
0:35
Structured light - first calibration tests (4th order, triangular, without 0.35m)by sugokuGENKI163 views
0:26
Arduino capacitive sensor demo.by memeteam5,200 views
9:06
Video Tutorial Arduino: Led RGB y Pulsadoresby pekepowah43,846 views
0:22
Instructables Arduino Tutorialby gunnk7,550 views
1:47
Iobridge serial smart board tutorialby cygnet8532,179 views
1:25
Arduino tutorial 2 - Blinkingby inthebitz14,363 views
7:38
Magic Drawing Boardby AmazingArends29,775 views
6:38
How to set up a Draw Boardby rthemm6913,357 views
0:52
Easy Arduino Robot Tutorial - Part Iby guib0t60,512 views
9:38
How-To Tuesday: Arduino 101 potentiometers and servosby makemagazine294,630 views
0:32
Domokun Dances to a Potentiometerby letsTube11180 views
- Loading more suggestions...
cool
Thynga3006 2 years ago
era um para o jaime, em cor de laranja se faz favor... :)
citoc2 2 years ago