Guest User

Untitled

a guest
May 24th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <Filoguidage.h>
  2. Filoguidage filoguidage;
  3. int pin = A11;
  4.  
  5. void setup() {
  6. Serial.begin(115200);
  7. pinMode(pin,INPUT);
  8. filoguidage.init(pin,10,10);
  9. }
  10. void loop() {
  11. int test = filoguidage.getPosition();
  12. Serial.println(test);
  13. }
  14.  
  15. #ifndef Filoguidage_h
  16. #define Filoguidage_h
  17. #include "Energia.h"
  18. class Filoguidage
  19. {
  20. public:
  21. void init(int PinCapteur,int valeurCentrale, int interval);
  22. int getPosition();
  23.  
  24. private:
  25. int _PinCapteur;
  26.  
  27. };
  28. #endif
  29.  
  30. #include "Energia.h"
  31. #include "Filoguidage.h"
  32.  
  33.  
  34. void Filoguidage::init(int PinCapteur,int valeurCentrale,int interval){
  35. int _PinCapteur = PinCapteur;
  36. pinMode(_PinCapteur, INPUT);
  37. }
  38. int Filoguidage::getPosition(){
  39. return analogRead( _PinCapteur );
  40. }
Add Comment
Please, Sign In to add comment