Arduino Wave Generator Tank (Speed Adjustable Only)



// Arduino Wave Tank II
// TVMiller

#include <Servo.h>

Servo left;
Servo right;

int pos = 20;
int back = 20;
int forward = 160;
int spe = 15;

int red = 6;
int green = 5;
int blue = 4;

void setup() {

Serial.begin(9600);

left.attach(2);
right.attach(3);

pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);

left.write(back);
right.write(back);

digitalWrite(green, HIGH);
delay(1000);
digitalWrite(green, LOW);
delay(1000);
digitalWrite(red, HIGH);
delay(1000);
digitalWrite(red, LOW);
delay(1000);

}

void loop() {

int pent = analogRead(A0);
Serial.println(pent);
spe = map(pent, 0, 1023, 15, 1);

if (spe >= 10) {
digitalWrite(green, HIGH);
digitalWrite(blue, LOW);
digitalWrite(red, LOW);
}
else if (spe < 10 && spe >= 5) {
digitalWrite(green, LOW);
digitalWrite(blue, HIGH);
digitalWrite(red, LOW);
}
else if (spe < 5 && spe >= 1) {
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
digitalWrite(red, HIGH);
}

for (pos = back; pos <= forward; pos += 1) {
left.write(pos);
right.write(pos);
delay(spe);
}
for (pos = forward; pos >= back; pos -= 1) {
left.write(pos);
right.write(pos);
delay(spe);
}
}

Archive
TVMiller - TVShow S01E16 Arduino Wave Generator Tank
TVShow S01E16 Arduino Wave Generator Tank




Welcome me matey to Davy Jones' miniature locker. To analyze yer wave and buoyancy mechanics while we plunder wenches, drink Rum and supplement with vitamin C, we rigged an Arduino Micro, (2) servos and potentiometer with if and for codes to generate various wave frequencies upon the sovereign seas (in a small acrylic case cast from a picture frame). Arrr--gh!

Written, Directed and Heave Ho'd by TVMiller
Filmed through 20,000 Leagues and Droid Razr

// Arduino Wave Tank
// TVMiller

#include <Servo.h>

Servo left;
Servo right;

int pos = 20;
int post = 160;
int back = 20;
int forward = 160;

int red = 6;
int green = 5;
int blue = 4;

int slow = 8;
int fast = 4;

void setup() {

Serial.begin(9600);

left.attach(2);
right.attach(3);

pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);

left.write(back);
right.write(back);

digitalWrite(green, HIGH);
delay(1000);
digitalWrite(green, LOW);
delay(1000);
digitalWrite(red, HIGH);
delay(1000);
digitalWrite(red, LOW);
delay(1000);

}

void loop() {

int pent = analogRead(A0);
Serial.println(pent);

if (pent < 200) {
digitalWrite(blue, HIGH);
digitalWrite(red, LOW);
digitalWrite(green, LOW);
for (pos = back; pos <= forward; pos += 1) {
left.write(pos);
right.write(pos);
delay(slow);
}
for (pos = forward; pos >= back; pos -= 1) {
left.write(pos);
right.write(pos);
delay(slow);
}
}
else if (pent > 200 && pent < 450) {
digitalWrite(blue, LOW);
digitalWrite(red, HIGH);
digitalWrite(green, LOW);
for (pos = back; pos <= forward; pos += 1) {
left.write(pos);
right.write(pos);
delay(fast);
}
for (pos = forward; pos >= back; pos -= 1) {
left.write(pos);
right.write(pos);
delay(fast);
}
}
else if (pent > 450 && pent < 700) {
digitalWrite(blue, LOW);
digitalWrite(red, LOW);
digitalWrite(green, HIGH);
for (pos = back; pos <= forward; pos += 1) {
post = map(pos, 20, 160, 160, 20);
left.write(pos);
right.write(post);
delay(slow);
}
for (pos = forward; pos >= back; pos -= 1) {
post = map(pos, 160, 20, 20, 160);
left.write(pos);
right.write(post);
delay(slow);
}
}
else if (pent > 700 && pent < 1023) {
digitalWrite(blue, LOW);
digitalWrite(red, HIGH);
digitalWrite(green, LOW);
for (pos = back; pos <= forward; pos += 1) {
post = map(pos, 20, 160, 160, 20);
left.write(pos);
right.write(post);
delay(fast);
}
for (pos = forward; pos >= back; pos -= 1) {
post = map(pos, 160, 20, 20, 160);
left.write(pos);
right.write(post);
delay(fast);
}
}

}

Archive
HackADay.io - Arduino Wave Generator Tank
Hackster.io - Arduino Wave Generator Tank
TVMiller - Arduino Wave Generator Tank (Speed Adjustable Only)
TVShow S01E15 Boxed In


In recognition of Ryan Reynolds performance in Buried as directed by Rodrigo CortÚs

Written, Directed and Corrugated by TVMiller
Filmed Through Packing Peanuts and Droid Razr
Empire of Gauhd Banner (1)


Empire of Gauhd
Project 47 is Empire of Gauhd