62 return USBSTA >> VBUS & 1;
84 const uint8_t sampleCount = 8;
86 for (uint8_t i = 0; i < sampleCount; i++)
88 sum += analogRead(pin);
95 const uint16_t correction = 16 * sampleCount - 1;
96 return ((uint32_t)sum * 625 + correction) / (32 * sampleCount);
119 const uint8_t sampleCount = 8;
121 for (uint8_t i = 0; i < sampleCount; i++)
123 sum += analogRead(pin);
130 const uint16_t correction = 64 * sampleCount - 1;
131 return ((uint32_t)sum * 1875 + correction) / (128 * sampleCount);
154 const uint8_t sampleCount = 8;
156 for (uint8_t i = 0; i < sampleCount; i++)
158 sum += analogRead(pin);
165 const uint16_t correction = 8 * sampleCount - 1;
166 return ((uint32_t)sum * 625 + correction) / (16 * sampleCount);
static void setOutput(bool value) __attribute__((always_inline))
Sets the pin as an output.
void ledYellow(bool on)
Turns the yellow user LED on pin 13 on or off.
uint16_t readBatteryMillivoltsLV3(uint8_t pin=A1)
Reads the battery voltage for an A-Star 32U4 Prime LV (ac03b) or Robot Controller LV and returns it i...
bool usbPowerPresent()
Returns true if USB power is detected.
uint16_t readBatteryMillivoltsSV(uint8_t pin=A1)
Reads the battery voltage for an A-Star 32U4 Prime SV or Robot Controller SV and returns it in milliv...
uint16_t readBatteryMillivolts(uint8_t pin=A1)
uint16_t readBatteryMillivoltsLV(uint8_t pin=A1)
uint16_t readBatteryMillivoltsLV4(uint8_t pin=A1)
Reads the battery voltage for an A-Star 32U4 Prime LV (ac03e) and returns it in millivolts.
void ledGreen(bool on)
Turns the green user LED (TX) on or off.
void ledRed(bool on)
Turns the red user LED (RX) on or off.