AStar32U4 library
Functions
AStar32U4.h File Reference
#include <FastGPIO.h>
#include <Pushbutton.h>
#include <AStar32U4LCD.h>
#include <AStar32U4Buzzer.h>
#include <AStar32U4Buttons.h>
#include <AStar32U4Motors.h>
#include <avr/io.h>
#include <stdint.h>

Go to the source code of this file.

Functions

void ledRed (bool on)
 Turns the red user LED (RX) on or off. More...
 
void ledYellow (bool on)
 Turns the yellow user LED on pin 13 on or off. More...
 
void ledGreen (bool on)
 Turns the green user LED (TX) on or off. More...
 
bool usbPowerPresent ()
 Returns true if USB power is detected. More...
 
uint16_t readBatteryMillivoltsLV4 (uint8_t pin=A1)
 Reads the battery voltage for an A-Star 32U4 Prime LV (ac03e) and returns it in millivolts. More...
 
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 in millivolts. More...
 
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 millivolts. More...
 
uint16_t readBatteryMillivolts (uint8_t pin=A1)
 
uint16_t readBatteryMillivoltsLV (uint8_t pin=A1)
 

Detailed Description

This is the main header file for the AStar32U4 library. It includes all the other header files provided by the library.

Definition in file AStar32U4.h.

Function Documentation

◆ ledGreen()

void ledGreen ( bool  on)
inline

Turns the green user LED (TX) on or off.

Parameters
on1 to turn on the LED, 0 to turn it off.

The green user LED is pin PD5, which is also known as TXLED. The Arduino core code uses this LED to indicate when it receives data over USB, so it might be hard to control this LED when USB is connected.

Definition at line 47 of file AStar32U4.h.

◆ ledRed()

void ledRed ( bool  on)
inline

Turns the red user LED (RX) on or off.

Parameters
on1 to turn on the LED, 0 to turn it off.

The red user LED is on pin 17, which is also known as PB0, SS, and RXLED. The Arduino core code uses this LED to indicate when it receives data over USB, so it might be hard to control this LED when USB is connected.

Definition at line 27 of file AStar32U4.h.

◆ ledYellow()

void ledYellow ( bool  on)
inline

Turns the yellow user LED on pin 13 on or off.

Parameters
on1 to turn on the LED, 0 to turn it off.

Definition at line 35 of file AStar32U4.h.

◆ readBatteryMillivolts()

uint16_t readBatteryMillivolts ( uint8_t  pin = A1)
inline
Deprecated:
This function is deprecated and is only here for backwards compatibility. We recommend using readBatteryMillivoltsLV4() or readBatteryMillivoltsLV3() instead.

Definition at line 172 of file AStar32U4.h.

◆ readBatteryMillivoltsLV()

uint16_t readBatteryMillivoltsLV ( uint8_t  pin = A1)
inline
Deprecated:
This function is deprecated and is only here for backwards compatibility. We recommend using readBatteryMillivoltsLV4() or readBatteryMillivoltsLV3() instead.

Definition at line 180 of file AStar32U4.h.

◆ readBatteryMillivoltsLV3()

uint16_t readBatteryMillivoltsLV3 ( uint8_t  pin = A1)
inline

Reads the battery voltage for an A-Star 32U4 Prime LV (ac03b) or Robot Controller LV and returns it in millivolts.

This function performs an analog reading and uses it to compute the voltage on the A-Star's VIN pin in millivolts. This only works if the specified pin (A1 by default) has been connected to BATLEV.

This function is only meant to be run on A-Stars with a 1/3 voltage divider:

  • A-Star 32U4 Prime LV (ac03b) (blue board)
  • A-Star 32U4 Robot Controller LV (blue board)

It will give incorrect results on other versions.

Parameters
pinThe pin number to read. This argument is passed on to analogRead. The default value is A1.
See also
readBatteryMillivoltsLV4(), readBatteryMillivoltsSV()

Definition at line 117 of file AStar32U4.h.

◆ readBatteryMillivoltsLV4()

uint16_t readBatteryMillivoltsLV4 ( uint8_t  pin = A1)
inline

Reads the battery voltage for an A-Star 32U4 Prime LV (ac03e) and returns it in millivolts.

This function performs an analog reading and uses it to compute the voltage on the A-Star's VIN pin in millivolts. This only works if the specified pin (A1 by default) has been connected to BATLEV.

This function is only meant to be run on A-Stars with a 1/4 voltage divider:

  • A-Star 32U4 Prime LV (ac03e) (blue board)

It will give incorrect results on other versions.

Parameters
pinThe pin number to read. This argument is passed on to analogRead. The default value is A1.
See also
readBatteryMillivoltsLV3(), readBatteryMillivoltsSV()

Definition at line 82 of file AStar32U4.h.

◆ readBatteryMillivoltsSV()

uint16_t readBatteryMillivoltsSV ( uint8_t  pin = A1)
inline

Reads the battery voltage for an A-Star 32U4 Prime SV or Robot Controller SV and returns it in millivolts.

This function performs an analog reading and uses it to compute the voltage on the A-Star 32U4 Prime SV's VIN pin in millivolts. This only works if the specified pin (A1 by default) has been connected to BATLEV.

This function is only meant to be run on A-Stars with a 1/8 voltage divider:

  • A-Star 32U4 Prime SV (green board)
  • A-Star 32U4 Robot Controller SV (green board)

It will give incorrect results on other versions.

Parameters
pinThe pin number to read. This argument is passed on to analogRead. The default value is A1.
See also
readBatteryMillivoltsLV4(), readBatteryMillivoltsLV3()

Definition at line 152 of file AStar32U4.h.

◆ usbPowerPresent()

bool usbPowerPresent ( )
inline

Returns true if USB power is detected.

This function returns true if power is detected on the board's USB port and returns false otherwise. It uses the ATmega32U4's VBUS line, which is directly connected to the power pin of the USB connector.

See also
A method for detecting whether the board's virtual COM port is open: http://arduino.cc/en/Serial/IfSerial

Definition at line 60 of file AStar32U4.h.