Pytronics is a Python library used to control the electronic hardware on the Rascal. This page describes the Pytronics functions available for use in response to web requests. If you need more detail, try looking at the Pytronics code itself.
The function read_pin() reads the voltage on one of the Rascal's digital pins. If the voltage is below 0.8 V, read_pin() returns 0. If the voltage is above 2.0 V, read_pin() returns 1. (Note that a voltage above 3.6 V will probably damage the Rascal's pins.)
Parameters
pin String consisting pin nameReturn type
Returns a string equal to either '0' or '1'.
The function read_analog() reads the voltage on one of the Rascal's analog inputs, scaled by the voltage on the A/D REF pin. A voltage of 0 V maps to a reading of 0. A voltage equal to or above the voltage on the A/D REF pin maps to a reading of 1023. (Note that a voltage above 3.6 V will probably damage the Rascal's pins.)
Parameters
pin String consisting pin nameReturn type
Returns a string containing a number in the range 0-1023.
On error, returns "Not an analog pin. Try 'A0', 'A1', 'A2', or 'A3'."
The function send_serial() is used to send data out the Rascal serial ports.
Parameters
text String consisting of text to be sent. Truncated after 80 characters.speed (optional) Integer. Defaults to 19200.port (optional) String ('1', '2', or '3'). Defaults to '1'.Return type
Returns None
The function set_pin_high() raises the voltage on one Rascal pin to 3.3 V.
Parameters
pin String consisting pin nameReturn type
Returns None
The function set_pin_low() lowers the voltage on one Rascal pin to 0 V.
Parameters
pin String consisting pin nameReturn type
Returns None