OneWire onewire(ONE_WIRE_PIN);
DallasTemperature dallas_sensors(&onewire);
DeviceAddress onShieldTemp = { 0x10, 0xE7, 0x77, 0xD3, 0x01, 0x08, 0x00, 0x3F };
+#define TEMPC_OFFSET
typedef struct {
byte offset;
dallas_sensors.requestTemperatures();
float tempC = dallas_sensors.getTempC(deviceAddress);
Serial.print("Temp C: ");
- Serial.println(tempC);
+ Serial.println(tempC TEMPC_OFFSET);
//Serial.print(" Temp F: ");
//Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
}
//********************************************************************//
+unsigned long wm_start_=0;
+bool wait_millis(unsigned long ms)
+{
+ if (wm_start_ > 0)
+ {
+ if (millis() < wm_start_ || millis() > wm_start_+ ms)
+ {
+ wm_start_=0;
+ return false;
+ }
+ else
+ return true;
+ }
+ else
+ {
+ wm_start_=millis();
+ return true;
+ }
+}
+
unsigned int flash_led_time_=0;
void calculate_led_level(unsigned int pwm_pin)
{
if (flash_led_time_ == 0)
return;
- if (millis() % 10)
+ if (wait_millis(10))
return;
flash_led_time_--;
int c = abs(sin(float(flash_led_time_) / 100.0)) * 256;
void flash_led(int times)
{
- flash_led_time_=314*times;
+ flash_led_time_ += 314*times;
}
//********************************************************************//
{
pb_postth_state=1;
Serial.println("PanicButton");
- flash_led(7);
+ flash_led(4);
}
else if (!pb_state)
pb_postth_state=0;