I was able to get a fan to turn on and off, as well as the vibration motor (the code was similar for each motor). However, it took too much time, so I did not have time to create a figure that interacted with the motor.
I connected the motor code to an IFTTT event so that the motors turned on 15 minutes before an event.
0
Process
I started with using the fan, hoping to create a ballon type effect. However, there were no stronger fans available, so the fan I had was not able to create the desired visual.
I switched to a vibration motor, using much of the same code, but it was very aggressive.
I tried using a servo, but I was unable to get it to function. Therefore, I ended up with only the fan and vibration effects.
0
Reflection
I had a vision for the final product, but did not slow down to consider the steps needed to get there. This led me to sink time into a fan that would not contribute to my final vision. Then, instead of working with my reduced capabilities - fan or vibration motor - I tried to switch to a servo motor. This lead me to sink my last bit of time into a new motor instead of refine and apply the motors I could use.
0
int solPin = D2;
bool shouldActivate = false;
void setup()
{
//Subscribe to an event that is triggered 15 minutes before a Google Calendar event using IFTT
Particle.subscribe( "activate",activateSolenoid );
pinMode(solPin, OUTPUT);
}
void loop()
{
}
//When event is received activate the Solenoid
void activateSolenoid(const char *event, const char *data)
{
do_Solenoid();
}
//Turn the Solenoid off and on
void doSolenoid( ){
digitalWrite( D2, HIGH );
delay (1000);
digitalWrite(D2,LOW);
delay (1000);
}
Click to Expand
0
//Incomplete servo code
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(D0); // attaches the servo on the D0 pin to the servo object
// Only supported on pins that have PWM
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}