Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void StartMode();
- void CodeEntry();
- void SuccessMode();
- void loop()
- {
- StartMode();
- CodeEntry();
- SuccessMode();
- }
- void StartMode(){
- //YOUR CODE HERE
- }
- void CodeEntry(){
- int no1;
- int no2;
- int no3;
- int guess1;
- int guess2;
- int guess3;
- int notSuccess=1; // Just so we only end this section when we actually finish it. Change it to a bool
- while(notSuccess){
- no1=map(analogRead(slider1),0,1023,0,9); //Maps the current position to a number between 0 and 9
- no2=map(analogRead(slider2),0,1023,0,9);
- no3=map(analogRead(slider3),0,1023,0,9);
- if (button1){
- //7SegPrint "no1" no idea how to actually do it right now
- guess1=no1;
- }
- //Repeat code for button2 and 3
- if (no1==guess1 && no2==guess2 && no3==guess3)
- notSuccess=1; //We found a match, so we should exit the loop and go to the next section
- }
- }
- void SuccessMode(){
- unsigned int previousMillis;
- unsigned int currentMillis;
- for (int i=0;i<36;i++){
- previousMillis=millis()
- while(currentMillis-previousMillis<endSongTime[i])
- currentMillis=millis()
- tone(buzzer, endSongNotes[i]):
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement