You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ioio/README.md
+19-20Lines changed: 19 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,24 @@
2
2
3
3
see: https://github.com/ytai/ioio/wiki
4
4
5
+
## IOIO
6
+
7
+
| Name | Description |
8
+
|---------|---------------|
9
+
| void ioio.beginBatch()|Start a batch of operations. This is strictly an optimization and will not change functionality|
10
+
| void ioio.disconnect()|Closes the connection to the board, or aborts a connection process started with waitForConnect()|
11
+
| void ioio.endBatch()|End a batch of operations.|
12
+
| void ioio.hardReset()|Equivalent to disconnecting and reconnecting the board power supply.|
13
+
| void ioio.softReset()|Resets the entire state (returning to initial state), without dropping the connection.|
14
+
| void ioio.sync()|Sends a message to the IOIO and waits for an echo.|
15
+
| void ioio.waitForConnect()|Establishes connection with the IOIO board.|
16
+
| void ioio.waitForDisconnect()|Blocks until IOIO has been disconnected and all connection-related resources have been freed so that a new connection can be attempted.|
17
+
5
18
## AnalogInput
6
19
7
20
This interface represents AnalogInput functionality, providing methods to obtain analog input readings and buffered samples.
8
21
9
-
`io = openAnalogInput(pin [, 1])`
22
+
`io = ioio.openAnalogInput(pin)`
10
23
11
24
| Name | Description |
12
25
|---------|---------------|
@@ -25,7 +38,7 @@ This interface represents AnalogInput functionality, providing methods to obtain
25
38
26
39
This interface represents PulseInput functionality, providing methods for pulse and frequency measurements.
27
40
28
-
`io = openPulseInput(pin [, 1])`
41
+
`io = ioio.openPulseInput(pin)`
29
42
30
43
| Name | Description |
31
44
|---------|---------------|
@@ -39,7 +52,7 @@ This interface represents PulseInput functionality, providing methods for pulse
39
52
40
53
This interface represents DigitalInput functionality, providing methods to read digital input pin values and wait for specific logical levels.
41
54
42
-
`io = openDigitalInput(pin [, 1])`
55
+
`io = ioio.openDigitalInput(pin)`
43
56
44
57
| Name | Description |
45
58
|---------|---------------|
@@ -50,7 +63,7 @@ This interface represents DigitalInput functionality, providing methods to read
50
63
51
64
This interface represents the CapSense functionality, allowing capacitance readings and threshold-based operations.
52
65
53
-
`io = openCapSense(pin [, 1])`
66
+
`io = ioio.openCapSense(pin)`
54
67
55
68
| Name | Description |
56
69
|---------|---------------|
@@ -66,7 +79,7 @@ This interface represents the CapSense functionality, allowing capacitance readi
66
79
67
80
A pin used for digital output. A digital output pin can be used to generate logic-level signals. DigitalOutput instances are obtained by calling IOIO#openDigitalOutput. The value of the pin is set by calling write. The instance is alive since its creation. If the connection with the IOIO drops at any point, the instance transitions to a disconnected state, in which every attempt to use the pin (except close()) will throw a ConnectionLostException. Whenever close() is invoked the instance may no longer be used. Any resources associated with it are freed and can be reused. Typical usage:
68
81
69
-
`io = openDigitalOutput(pin [, 1])`
82
+
`io = ioio.openDigitalOutput(pin)`
70
83
71
84
| Name | Description |
72
85
|---------|---------------|
@@ -76,24 +89,10 @@ A pin used for digital output. A digital output pin can be used to generate logi
76
89
77
90
A pin used for PWM (Pulse-Width Modulation) output. A PWM pin produces a logic-level PWM signal. These signals are typically used for simulating analog outputs for controlling the intensity of LEDs, the rotation speed of motors, etc. They are also frequently used for controlling hobby servo motors. PwmOutput instances are obtained by calling IOIO#openPwmOutput. When used for motors and LEDs, a frequency of several KHz is typically used, where there is a trade-off between switching power-loses and smoothness of operation. The pulse width is typically set by specifying the duty cycle, with the setDutyCycle method. A duty cycle of 0 is \"off\", a duty cycle of 1 is \"on\", and every intermediate value produces an intermediate intensity. Please note that any devices consuming more than 20mA of current (e.g. motors) should not by directly connected the the IOIO pins, but rather through an amplification circuit suited for the specific load. When used for hobby servos, the PWM signal is rather used for encoding of the desired angle the motor should go to. By standard, a 100Hz signal is used and the pulse width is varied between 1ms and 2ms (corresponding to both extremes of the shaft angle), using setPulseWidth. The instance is alive since its creation. If the connection with the IOIO drops at any point, the instance transitions to a disconnected state, in which every attempt to use the pin (except close()) will throw a ConnectionLostException. Whenever close() is invoked the instance may no longer be used. Any resources associated with it are freed and can be reused. Typical usage (fading LED):
78
91
79
-
`io = openPwmOutput(pin [, 1])`
92
+
`io = ioio.openPwmOutput(pin)`
80
93
81
94
| Name | Description |
82
95
|---------|---------------|
83
96
|void setDutyCycle(float)|Sets the duty cycle of the PWM output. The duty cycle is defined to be the pulse width divided by the total cycle period. For absolute control of the pulse with, consider using setPulseWidth.|
84
97
|void setPulseWidth(float)|Sets the pulse width of the PWM output. The pulse width is duration of the high-time within a single period of the signal. For relative control of the pulse with, consider using setDutyCycle.|
85
98
86
-
## Optional second argument
87
-
88
-
Option second argument `1` causes the following additional IOIO methods to be attached:
89
-
90
-
| Name | Description |
91
-
|---------|---------------|
92
-
| void beginBatch()|Start a batch of operations. This is strictly an optimization and will not change functionality|
93
-
| void disconnect()|Closes the connection to the board, or aborts a connection process started with waitForConnect()|
94
-
| void endBatch()|End a batch of operations.|
95
-
| void hardReset()|Equivalent to disconnecting and reconnecting the board power supply.|
96
-
| void softReset()|Resets the entire state (returning to initial state), without dropping the connection.|
97
-
| void sync()|Sends a message to the IOIO and waits for an echo.|
98
-
| void waitForConnect()|Establishes connection with the IOIO board.|
99
-
| void waitForDisconnect()|Blocks until IOIO has been disconnected and all connection-related resources have been freed so that a new connection can be attempted.|
0 commit comments