Hello, my name is Christopher Flango, and this is my son, Gurvin,
a music box. as you can see from the labels, this top button controls a servo, which
is good for backing beats in your most recent SoundCloud mixtape. This effect
is created by attached a quarter of a roll of scotch tape to the servo motor
and a ball, which when activated causes the ball to repeatedly bash against the
cardboard walls in a rhythmic fashion. This other button, labelled music,
controls the song, an original piece I call "Wings Upon the Precipice of
Dawn Mark 2". Originally this was to be a meme song, in the vein of "Chug Jug With You" but after an hour of
struggling to get it working, I accidentally created the song you hear instead
and thought that it sounded pretty good. You'll notice that there's no potentiometer,
due to technical difficulties in getting it to run properly without messing up
the functions of the other settings. Originally, I wanted to include it as a
means to control an LED on the box, but after failing to get it working, I
scrapped that and covered up the hole where the LED was supposed to go. I thought
the music would be the hardest part of this, as I have no background in making
it, but honestly that was easiest part of this. In the future, I’ll have to
allow myself more time to create the code to get everything functioning
properly. How should I have gone about implementing the potentiometer?
#include <Servo.h>
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>
//Created bt Christopher Flango
//Servo variables
Servo GurvinWeapon;
int pol = 0;
void setup() {
// put your setup code here, to run once:
GurvinWeapon.attach(A3);
pinMode(A4, INPUT);
delay(1000);
}
void loop()
{
//this controls the button for the music
if (digitalRead(CPLAY_RIGHTBUTTON))
{
CircuitPlayground.playTone(200, 300);
CircuitPlayground.playTone(600, 200);
CircuitPlayground.playTone(600, 100);
CircuitPlayground.playTone(400, 400);
CircuitPlayground.playTone(600, 300);
CircuitPlayground.playTone(600, 200);
CircuitPlayground.playTone(400, 100);
CircuitPlayground.playTone(300, 400);
}
//this controls the button for the servo
if (digitalRead(CPLAY_LEFTBUTTON))
{
//these control the propellor blades on the server
GurvinWeapon.write(95);
delay(100);
GurvinWeapon.write(10);
delay(100);
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.