Bits | Unsigned value | Two's complement value |
---|---|---|
011 | 3 | 3 |
010 | 2 | 2 |
001 | 1 | 1 |
000 | 0 | 0 |
111 | 7 | −1 |
110 | 6 | −2 |
101 | 5 | −3 |
100 | 4 | −4 |
Bits | Unsigned value | Two's complement value |
---|---|---|
0111 1111 | 127 | 127 |
0111 1110 | 126 | 126 |
0000 0010 | 2 | 2 |
0000 0001 | 1 | 1 |
0000 0000 | 0 | 0 |
1111 1111 | 255 | −1 |
1111 1110 | 254 | −2 |
1000 0010 | 130 | −126 |
1000 0001 | 129 | −127 |
1000 0000 | 128 | −128 |
/*--------------------------------
double log (double __x) // natural logarithm of x
double log10 (double __x) // logarithm of x to base 10.
/*-----------------------------------------------
lcd.print("TEMP " + (String)(int)Temp_start + "," + (String)(int)Temp_cut );
/*-------------------------------
By-pass and de-coupling capacitors
are commonly used to control the voltage on the VCC pin,
- using a larger capacitor to provide additional power in the event of a short power supply glitch
- and a smaller capacitor to filter out high-frequency ripple.
/*--------------------------------
credit: https://forum.arduino.cc/index.php?topic=372547.0
INSTRUCTIONS:
/*------------------------------------
set bit ตามตำแหน่งที่ต้องการ
/*-----------------------
/*-----------------------------------------------
Wrote a test for floats to check for special values. NAN and INFINITY and isnan(), isinf() and isfinite() are defined in math.h.
int testFloat(float f)
{
if (f == 1/0L) Serial.println("NaN divide by 0L");
if (f == 1/0UL) Serial.println("NaN divide by 0UL");
if (f == NAN) Serial.println("NaN");
if (f == INFINITY) Serial.println("INFINITY");
if (-f == INFINITY)Serial.println("-INFINITY");
if (isnan(f)) Serial.println("isnan");
if (isinf(f)) Serial.println("isinf");
if (isfinite(f)) Serial.println("isfinite = OK");
return 0;
}
lcd.print("TEMP " + (String)(int)Temp_start + "," + (String)(int)Temp_cut );
/*-------------------------------
By-pass and de-coupling capacitors
are commonly used to control the voltage on the VCC pin,
- using a larger capacitor to provide additional power in the event of a short power supply glitch
- and a smaller capacitor to filter out high-frequency ripple.
/*--------------------------------
credit: https://forum.arduino.cc/index.php?topic=372547.0
The first thing to do is ensure you have your relay module connected properly and adequately powered. This example shows how to make use of the optic isolation feature.
INSTRUCTIONS:
- Remove blue jumper
- Connect JD-VCC and GND from the Relay Module to a Separate 5VDC Supply (1Amp or greater)
- Connect VCC from the Relay Module to 5V on your Arduino
- Connect required control signals as shown
- Note: DO NOT connect GND from the Relay Module to your Arduino
/*------------------------------------
set bit ตามตำแหน่งที่ต้องการ
Use the bitwise
or
and and
operators. To set a bit:
เซต bit=1 ที่ตำแหน่ง pos
my_byte = my_byte | (1 << pos);
To un-set a bit:
เซต bit=0 ที่ตำแหน่ง pos
my_byte = my_byte & ~(1 << pos);
credit http://stackoverflow.com/questions/4674006/set-specific-bit-in-byte/*-----------------------
difference between ESP.reset() and ESP.restart()?
- Created: Tuesday, 19 April 2016 08:02
What´s the difference between ESP.reset() and ESP.restart()?
Both work, but sometimes the ESP does not start again.
Answer:
ESP.reset()
is a hard reset and can leave some of the registers in the old state which can lead to problems, its more or less like the reset button on the PC.ESP.restart()
tells the SDK to reboot, so its a more clean reboot, use this one if possible.
the
if you do one manual reboot by power or RST pin all will work more info see: #1017
boot mode:(1,7)
problem is known and only happens at the first restart after serial flashing.if you do one manual reboot by power or RST pin all will work more info see: #1017
/*-----------------------------------------------
Wrote a test for floats to check for special values. NAN and INFINITY and isnan(), isinf() and isfinite() are defined in math.h.
int testFloat(float f)
{
if (f == 1/0L) Serial.println("NaN divide by 0L");
if (f == 1/0UL) Serial.println("NaN divide by 0UL");
if (f == NAN) Serial.println("NaN");
if (f == INFINITY) Serial.println("INFINITY");
if (-f == INFINITY)Serial.println("-INFINITY");
if (isnan(f)) Serial.println("isnan");
if (isinf(f)) Serial.println("isinf");
if (isfinite(f)) Serial.println("isfinite = OK");
return 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น