nakujaproject / avionicsv1

0 stars 0 forks source link

Code used with processing. #4

Closed rodneyosodo closed 3 years ago

rodneyosodo commented 3 years ago

I added the code I had made some time back using the MPU6050 and processing software. It shows a graphical interface of the rocket and models in real time the orientation.

kimanimichael commented 3 years ago

include

bool state = false; bool state2 = false;

unsigned long currentMillis; unsigned long startMillis; Servo servo; void setup() { // put your setup code here, to run once: Serial.begin(9600); //Serial.println("Turned"); servo.attach(32); // startMillis = millis(); servo.write(0); }

void loop() { // put your main code here, to run repeatedly: currentMillis = millis(); Serial.println(currentMillis); if ((currentMillis-startMillis >= 6000) && (state == false)){ servo.write(90); Serial.println("Hello"); state = true; }

if (currentMillis-startMillis >= 20000 && (state2 == false)){ Serial.println("World"); servo.write(0); state2 = true; }

//servo.write(120); //delay(500); }