studuino package¶
Submodules¶
studuino.command module¶
-
studuino.command.
start
(comPort, baud=38400)¶ Connect to the Studuino board and run python script.
Parameters: - comPort (str) – Serial port name
- baud (int) – baud rate (default:38400)
-
studuino.command.
stop
()¶ Disonnect the Studuino board.
studuino.connector module¶
-
class
studuino.connector.
Connector
(id)¶ Bases:
object
Base class of connectors.
-
class
studuino.connector.
ConnectorDC
(id)¶ Bases:
studuino.connector.Connector
DC motor connector
-
class
studuino.connector.
ConnectorSensor
(id)¶ Bases:
studuino.connector.Connector
Sensor connector
-
class
studuino.connector.
ConnectorServo
(id)¶ Bases:
studuino.connector.Connector
Servomotor connector
studuino.const module¶
-
studuino.const.
A0
= <studuino.connector.ConnectorSensor object at 0x3574790>¶ Analog sensor connector A0.
-
studuino.const.
A1
= <studuino.connector.ConnectorSensor object at 0x35747d0>¶ Analog sensor connector A1.
-
studuino.const.
A2
= <studuino.connector.ConnectorSensor object at 0x3574810>¶ Analog sensor connector A2.
-
studuino.const.
A3
= <studuino.connector.ConnectorSensor object at 0x3574850>¶ Analog sensor connector A3.
-
studuino.const.
A4
= <studuino.connector.ConnectorSensor object at 0x3574890>¶ Analog sensor connector A4.
-
studuino.const.
A5
= <studuino.connector.ConnectorSensor object at 0x35748d0>¶ Analog sensor connector A5.
-
studuino.const.
A6
= <studuino.connector.ConnectorSensor object at 0x3574910>¶ Analog sensor connector A6.
-
studuino.const.
A7
= <studuino.connector.ConnectorSensor object at 0x3574950>¶ Analog sensor connector A7.
-
studuino.const.
BCK
= 1¶ Constants for rotating DC motor in backward.
-
studuino.const.
BRAKE
= 2¶ Constants for stopping DC motor with brake.
-
studuino.const.
COAST
= 3¶ Constants for stopping DC motor without brake.
-
studuino.const.
D10
= <studuino.connector.ConnectorServo object at 0x35746d0>¶ Servomotor connector D10.
-
studuino.const.
D11
= <studuino.connector.ConnectorServo object at 0x3574710>¶ Servomotor connector D11.
-
studuino.const.
D12
= <studuino.connector.ConnectorServo object at 0x3574750>¶ Servomotor connector D12.
-
studuino.const.
D2
= <studuino.connector.ConnectorServo object at 0x3574590>¶ Servomotor connector D2.
-
studuino.const.
D4
= <studuino.connector.ConnectorServo object at 0x35745d0>¶ Servomotor connector D4.
-
studuino.const.
D7
= <studuino.connector.ConnectorServo object at 0x3574610>¶ Servomotor connector D7.
-
studuino.const.
D8
= <studuino.connector.ConnectorServo object at 0x3574650>¶ Servomotor connector D8.
-
studuino.const.
D9
= <studuino.connector.ConnectorServo object at 0x3574690>¶ Servomotor connector D9.
-
studuino.const.
DO
= 60¶ Sound constant for “Do”.
-
studuino.const.
DO_
= 61¶ Sound constant for “Do#”.
-
studuino.const.
FA
= 65¶ Sound constant for “Fa”.
-
studuino.const.
FA_
= 66¶ Sound constant for “Fa#”.
-
studuino.const.
FWD
= 0¶ Constants for rotating DC motor in forward.
-
studuino.const.
LA
= 69¶ Sound constant for “La”.
-
studuino.const.
LA_
= 70¶ Sound constant for “La#”.
-
studuino.const.
M1
= <studuino.connector.ConnectorDC object at 0x3574510>¶ DC motor connector M1.
-
studuino.const.
M2
= <studuino.connector.ConnectorDC object at 0x3574550>¶ DC motor connector M2.
-
studuino.const.
MI
= 64¶ Sound constant for “Mi”.
-
studuino.const.
OFF
= 0¶ Constants for turning LED/Buzzer off.
-
studuino.const.
ON
= 1¶ Constants for turning LED/Buzzer on.
-
studuino.const.
RE
= 62¶ Sound constant for “Re”.
-
studuino.const.
RE_
= 63¶ Sound constant for “Re#”.
-
studuino.const.
SO
= 67¶ Sound constant for “So”.
-
studuino.const.
SO_
= 68¶ Sound constant for “So#”.
-
studuino.const.
TI
= 71¶ Sound constant for “Ti”.
studuino.part module¶
-
class
studuino.part.
Accelerometer
¶ Bases:
studuino.part.Sensor
Accelerometer Class
-
getValue
()¶ Returning the acceleration values.
Return type: int[] Returns: Array of acceleration (x, y, z).
-
id
¶ Acceoerometer’s part ID
Return type: int Returns: 0x14
-
name
¶ Acceoerometer’s part name
Return type: str Returns: “Accelerometer”
-
-
class
studuino.part.
AnalogSensor
¶ Bases:
studuino.part.Sensor
Analog Sensor Class
-
class
studuino.part.
Buzzer
¶ Bases:
studuino.part.Part
Buzzer Class
-
id
¶ Buzzer’s part ID
Return type: int Returns: 0x04
-
name
¶ Buzzer’s part name
Return type: str Returns: “Buzzer”
-
off
()¶ Stop the buzzer.
-
on
(sound, octave=0, duration=0)¶ Play the specified type of sound.
Parameters: - sound (int) – Sound ID registered int studuino.const.
- octave (int) – Octaves of the sound [0-8].
- duration (int) – Duration of the sound in milliseconds.
-
-
class
studuino.part.
DCMotor
¶ Bases:
studuino.part.Part
DC Motor Class
-
id
¶ DC motor’s part ID
Return type: int Returns: DC motor’s part ID.
-
move
(motion)¶ Rotate the dc motor by specified motion type.
Parameters: motion (int) – The number representing the motion type. [FWD|BCK]
-
name
¶ 関数の説明
Return type: str Returns: “DC Motor”
-
setPower
(power)¶ Set the DC motor’s power.
Parameters: power (int) – DC motor power [0-100].
-
stop
(motion)¶ Stop the dc motor by specified motion type.
Parameters: motion (int) – The number representing the motion type. [BRAKE|COAST]
-
-
class
studuino.part.
DigitalSensor
¶ Bases:
studuino.part.Sensor
Digital Sensor Class
-
class
studuino.part.
IRPhotoreflector
¶ Bases:
studuino.part.AnalogSensor
IR photo reflector Class
-
id
¶ IR Photoreflector’s part ID.
Return type: int Returns: 0x13
-
name
¶ IR Photoreflector’s part name.
Return type: str Returns: “IRPhotorefrector”
-
-
exception
studuino.part.
InitException
(value)¶ Bases:
exceptions.Exception
Init exeception Class
-
class
studuino.part.
LED
¶ Bases:
studuino.part.Part
LED Class
-
id
¶ LED’s part ID
Return type: int Returns: 0x03
-
name
¶ LED’s part name
Return type: str Returns: “LED”
-
off
()¶ Turning the LED off.
-
on
()¶ Turning the LED on.
-
-
class
studuino.part.
LightSensor
¶ Bases:
studuino.part.AnalogSensor
Light Sensor Class
-
id
¶ Light sensor’s part ID
Return type: int Returns: 0x10
-
name
¶ Light sensor’s part name
Return type: str Returns: “Light sensor”
-
-
class
studuino.part.
Part
¶ Bases:
object
Parts Class
-
attach
(connector)¶ Attach the part to the specified connector.
Parameters: connector (Connector) – A Connector object defined in studuino.connector.
-
id
¶ Part ID
-
name
¶ Part name
-
-
class
studuino.part.
PushSwitch
¶ Bases:
studuino.part.DigitalSensor
Push switch Class
-
id
¶ Push switch’s part ID
Return type: int Returns: 0x15
-
name
¶ Push switch’s part name
Return type: str Returns: “Push switch”
-
-
class
studuino.part.
Sensor
¶ Bases:
studuino.part.Part
Sensor Class
-
getValue
()¶ Returning the sensor’s value.
Return type: int Returns: Sensor value (Digital Sensor:[0|1] Analog Sensor:[0-100])
-
-
class
studuino.part.
Servomotor
¶ Bases:
studuino.part.Part
Servo Motor Class
-
id
¶ Servomotor’s part ID
Return type: int Returns: 0x02
-
name
¶ Servomotor’s part name
Return type: str Returns: “Servomotor”
-
setAngle
(angle)¶ Set the servomotor’s angle
Parameters: angle (int) – Servomotor’s angle in degree.
-
static
syncMove
(servos, angles, delay)¶ 関数の説明
Parameters: - servos (int[]) – Array of servomotor port.
- angles (int[]) – Array of servomotor angle.
- delay (int) – Delay time per 1 degree [milliseconds].
-
-
class
studuino.part.
SoundSensor
¶ Bases:
studuino.part.AnalogSensor
Sound Sensor Class
-
id
¶ Sound sensor’s part ID.
Return type: int Returns: 0x12
-
name
¶ Sound sensor’s part name.
Return type: str Returns: “Sound sensor”
-
-
class
studuino.part.
TouchSensor
¶ Bases:
studuino.part.DigitalSensor
Touch Sensor Class
-
id
¶ Touch sensor’s part ID.
Return type: int Returns: 0x11
-
name
¶ Touch sensor’s part name.
Return type: str Returns: “Touch sensor”
-