Skip to content

Instantly share code, notes, and snippets.

@ynwa-ynwa
Created September 8, 2018 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ynwa-ynwa/8977feefb1e9c99e90f591aaf8dbc1e8 to your computer and use it in GitHub Desktop.
Save ynwa-ynwa/8977feefb1e9c99e90f591aaf8dbc1e8 to your computer and use it in GitHub Desktop.
Automatický party bublifuk
/*
Calibrate Continuous Rotation Servo
// based on <http://arduino.cc/en/Tutorial/Sweep>
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
modified Jan 2013
by Markus Loder-Taucher
*/
// include the TinkerKit library
#include <TinkerKit.h>
// include the Servo library
#include <Servo.h>
Servo TKRotationServo; // create servo object to control a servo
Servo TKRotationServo2;
// a maximum of eight servo objects can be created
TKMosFet ventilator(O2);
void setup()
{
Serial.begin(9600);
Serial.println("start");
TKRotationServo.attach(O0); // attaches the servo on pin 9 to the servo object
TKRotationServo2.attach(O1);
pinMode(I0, INPUT);
pinMode(O3, OUTPUT);
}
void bublifuk_proces() {
// TKRotationServo.write(135);
// delay(1000);
TKRotationServo.write(16);
delay(1000);
TKRotationServo2.write(14);
// máchání
delay(500);
TKRotationServo2.write(25);
delay(500);
TKRotationServo2.write(14);
delay(500);
TKRotationServo2.write(25);
delay(500);
TKRotationServo2.write(14);
delay(500);
TKRotationServo2.write(25);
delay(500);
TKRotationServo2.write(14);
delay(500);
TKRotationServo2.write(60);
delay(500);
// oklepávání
TKRotationServo2.write(50);
delay(500);
TKRotationServo2.write(70);
delay(500);
TKRotationServo2.write(50);
delay(500);
TKRotationServo2.write(70);
delay(500);
TKRotationServo2.write(50);
delay(500);
TKRotationServo2.write(80);
delay(500);
TKRotationServo.write(110);
delay(500);
ventilator.on();
delay(7000);
TKRotationServo2.write(120);
ventilator.off();
delay(1000);
}
void beep(int len, int del, int cnt) {
for (int i = 0; i < cnt; i++) {
digitalWrite(O3, HIGH);
delay(len);
digitalWrite(O3, LOW);
delay(del);
}
}
void loop() {
if (digitalRead(I0) == LOW) return;
beep(30,150,3);
bublifuk_proces();
bublifuk_proces();
bublifuk_proces();
beep(70,50,2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment