comprare viagra pastilla cialis trouble erection cialis kopen sildenafil venta viagra fur frauen kamagra pharmacie viagra europe cialis venta cialis meilleur prix zithromax generique achat cialis en ligne cialis moins cher viagra kosten acheter isotretinoine generische viagra dysfonction erectile acheter cialis 20mg ordina levitra levitra france sildenafil generico generique du viagra commander du viagra sildenafil sin receta acheter viagra pas chere procurer du cialis sildenafil 50 mg achat de levitra vente levitra viagra svizzera acquisto viagra generico cialis livraison rapide viagra versand levitra te koop vente kamagra levitra en pharmacie viagra controindicazioni levitra a vendre cialis belgique sildenafil rezeptfrei comprar viagra em portugal aquisto levitra comprar vardenafil cialis generico viagra effet secondaire vendo cialis prezzi cialis achat cialis 20mg kamagra rezeptfrei acheter cialis pas chere kamagra gel levitra sin receta farmaci impotenza viagra moins cher acheter viagra kamagra kopen remede impuissance cialis bon prix cialis sans ordonnance tadalafil bestellen viagra generique comprar viagra cialis suisse prozac prix cialis generique acheter levitra naturale cialis generico 10 mg acheter propecia clomid sans ordonnance acquisto viagra net levitra 20 mg acquisto viagra vardenafil generique sildenafil kaufen cialis generico sicuro commande levitra viagra generico vendo levitra levitra 20 mg disfunzione erettile rimedi cialis france levitra svizzera sildenafil receta achete cialis viagra prezzo comprar levitra generica cialis preço levitra venta libre cialis ohne rezept aquisto cialis vardenafil bestellen pilule levitra impotenza cure achat viagra en ligne generique du cialis viagra vendita libera kamagra en france acquisto cialis generico cura impotenza compro viagra cialis generique en france vente cialis viagra donna propecia sans ordonnance levitra sans prescription acheter cialis sur internet impotenza rimedi levitra donna cialis prijs achat de viagra viagra dosaggio viagra kopen kamagra generique compro sildenafil tadalafil generique acheter cialis internet levitra donne viagra 100 mg acheter cialis moins cher levitra generico medicament viagra acheter kamagra acheter zyban cialis generique cialis venta libre vente de cialis sur internet levitra ohne rezept acheter cialis en espagne vardenafil generico cialis ricetta medica viagra 100 mg vendita levitra

Etch-a-Sketch


Arduino Floating Ball from droops on Vimeo.


Arduino Etch-a-Sketch from droops on Vimeo.

I had seen some similar things on the internet, but I wanted to make my own.  I took 3 pots hooked up to analog inputs on my Arduino and then sent a serial connection that looked like this:

X56
Y378
Z5
X68
Y378
Z6

Using Processing, I read that stream and displayed the variables on the screen.  So you can change the horizontal, vertical, and size of the drawing dot.  I also included a grey dot in the middle of the big dot, so you have a reference of where your dot is.  This code isn’t fancy and allows for many upgrades.  Most importantly, I am not redrawing the background to allow for the green dots to draw lines, don’t worry, I left a few comments to help you out.

All you need is a duino, 3 pots, processing, and the arduino ide.

/*
Duino Etch-a-Sketch

by droops
http://dailyduino.com

I used sources from all over the internet, so thanks for the code, please use mine

Sometimes it doesnt run and will dump out an error, just try to run it again before
you get all crazy and start throwing things

*/

import processing.serial.*;

Serial myPort;
String inString;  // Input string from serial port:
String letter;
int number;
String numberS;
int x, y, z;

int redColor = 12;
int blueColor = 170;
int greenColor = 21;

int lf = 10;

void setup() {
size(512, 512);
//you may have to change the serial port
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil(lf);

background(0);
}

void draw() {
//  background(0);  //uncomment this to just have a floating ball

stroke(redColor, blueColor, greenColor); //changing colors are for version 2
fill(redColor, blueColor, greenColor);
smooth();
ellipse(x, y, z, z); //this is the circle

stroke(255);  //color of point
point(x, y);  //point inside circle, comment this to remove

}

void serialEvent(Serial p) {
inString = (myPort.readString());

letter = inString.substring(0, 1);
numberS = inString.substring(2);
numberS = trim(numberS);
number = Integer.parseInt(numberS); //I could have combined a bit of this, but this code is for learning

if(letter.equals("X") == true) {
x = number;
}
if(letter.equals("Y") == true) {
y = number;
}
if(letter.equals("Z") == true) {
z = number;
}

}

/*

//Arduino Code for Etch-a-Sketch

int rightPin = 3; //analog pin for right hand knob
int leftPin = 2;  //analog pin for left hand knob
int widthPin = 1; //analog pin for center knob (width)

//Info for Serial Data
int id_1 = 'X';
int id_2 = 'Y';
int id_3 = 'Z';
int space = ' ';

void setup()
{
pinMode(rightPin, INPUT);
pinMode(leftPin, INPUT);
pinMode(widthPin, INPUT);

Serial.begin(9600);
}

void loop()
{
int rightNum = analogRead(rightPin);
int leftNum = analogRead(leftPin);
int widthNum = analogRead(widthPin);

//the arduino will read from 0 to 1024 on teh analog pins, so we divide that by 2
//to fit in the 512x512 screen
//by doing this simple math on the arduino, it may make things faster
rightNum = rightNum / 2;
leftNum = leftNum / 2;
//we divide the widthNum by 50 so that the elipse can be a bit bigger, play with this number
widthNum = widthNum / 50;

printByte(id_1);
printByte(space);
printInteger(rightNum);  printByte(10);

printByte(id_2);
printByte(space);
printInteger(leftNum);  printByte(10);

printByte(id_3);
printByte(space);
printInteger(widthNum);  printByte(10);

delay(10);

}

*/

 

Leave a Reply



  • Viagra ordre
  • Cialis en ligne
  • Levitra en ligne
  • Propecia acheter
  • Viagra acheter
  • Acheter cialis
  • Ordre levitra
  • Ordre propecia
  • En ligne viagra
  • Vente cialis
  • Levitra bon marche
  • Propecia en ligne
  • Viagra online
  • Buy cialis
  • Order Levitra
  • Buy propecia
  • Buy viagra
  • Cheap cialis
  • Cheap Levitra
  • propecia online
  • Viagra prescription
  • Cialis online
  • Buy Levitra
  • Order propecia