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
865 B

  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. if(!err){
  20. int16_t readData;
  21. radio.read(&readData, sizeof(int16_t));
  22. temperature = readData;
  23. }
  24. radio.stopListening();
  25. clearCommands();
  26. }
  27. }