Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. void StartMode();
  2. void CodeEntry();
  3. void SuccessMode();
  4.  
  5. void loop()
  6. {
  7.  
  8. StartMode();
  9. CodeEntry();
  10. SuccessMode();
  11. }
  12.  
  13. void StartMode(){
  14. //YOUR CODE HERE
  15. }
  16.  
  17. void CodeEntry(){
  18. int no1;
  19. int no2;
  20. int no3;
  21. int guess1;
  22. int guess2;
  23. int guess3;
  24.  
  25. int notSuccess=1; // Just so we only end this section when we actually finish it. Change it to a bool
  26. while(notSuccess){
  27. no1=map(analogRead(slider1),0,1023,0,9); //Maps the current position to a number between 0 and 9
  28. no2=map(analogRead(slider2),0,1023,0,9);
  29. no3=map(analogRead(slider3),0,1023,0,9);
  30. if (button1){
  31. //7SegPrint "no1" no idea how to actually do it right now
  32. guess1=no1;
  33. }
  34. //Repeat code for button2 and 3
  35. if (no1==guess1 && no2==guess2 && no3==guess3)
  36. notSuccess=1; //We found a match, so we should exit the loop and go to the next section
  37. }
  38.  
  39.  
  40. }
  41.  
  42.  
  43. void SuccessMode(){
  44. unsigned int previousMillis;
  45. unsigned int currentMillis;
  46.  
  47. for (int i=0;i<36;i++){
  48. previousMillis=millis()
  49. while(currentMillis-previousMillis<endSongTime[i])
  50. currentMillis=millis()
  51. tone(buzzer, endSongNotes[i]):
  52.  
  53. }
  54.  
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement