Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
991 B

5 years ago
5 years ago
5 years ago
  1. //Temperatur <3
  2. void updateTemp(){
  3. unsigned long currentMillis = millis();
  4. if((unsigned long)(currentMillis - temp_time) >= 1000){ // jede Sekunden
  5. temp_time = millis();
  6. bool err = false;
  7. clearCommands();
  8. commands[0] = getTemp;
  9. radio.write(&commands, sizeof(commands) /* && !err */);
  10. unsigned long start = micros();
  11. radio.startListening();
  12. while(!radio.available()){
  13. //Serial.println("nix");
  14. unsigned long currentMicros = micros();
  15. if((unsigned long)(currentMicros - start) >= 1){
  16. err = true;
  17. }
  18. /*
  19. int16_t readData;
  20. radio.read(&readData, sizeof(int16_t));
  21. temperature = readData; */
  22. }
  23. if(!err){
  24. int16_t readData;
  25. radio.read(&readData, sizeof(int16_t));
  26. temperature = readData;
  27. }
  28. radio.stopListening();
  29. clearCommands();
  30. }
  31. }