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.

29 lines
873 B

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