|
| 1 | +# IOIO plugin |
| 2 | + |
| 3 | +The IOIO is a board that provides a host machine the capability |
| 4 | +of interfacing with external hardware over a variety of commonly |
| 5 | +used protocols. The original IOIO board has been specifically |
| 6 | +designed to work with Android devices. The newer IOIO-OTG |
| 7 | +("on the go") boards work with both Android devices and PC's. |
| 8 | +The IOIO board can be connected to its host over |
| 9 | +USB or Bluetooth, and provides a high-level Java API on the host |
| 10 | +side for using its I/O functions as if they were an integral |
| 11 | +part of the client. ([IOIO website](https://github.com/ytai/ioio/wiki)) |
| 12 | + |
| 13 | +## How to learn coding for IOIO |
| 14 | + |
| 15 | +For most of the protocols you can find a SmallBASIC example at |
| 16 | +[Github](https://github.com/smallbasic/smallbasic.plugins/tree/master/ioio/samples). |
| 17 | +Below is a list with all examples and an image how to wire. |
| 18 | +If you are new to IOIO it is best to start with the first example. |
| 19 | + |
| 20 | +A simple SmallBASIC cheatsheet is available at |
| 21 | +[Github](https://github.com/smallbasic/smallbasic.plugins/tree/master/ioio). |
| 22 | + |
| 23 | +For further information please visit the [IOIO website](https://github.com/ytai/ioio/wiki). |
| 24 | + |
| 25 | +## How to setup SmallBASIC to use the IOIO plugin |
| 26 | + |
| 27 | +Getting IOIO running on a PC (Linux) requires to build the plugin from source. This is not part of this document. |
| 28 | + |
| 29 | +Using IOIO on Android is quite easy: |
| 30 | + |
| 31 | +- Launch SmallBASIC and then click on "Setup". |
| 32 | +- On the second screen, click to "Load extension modules". |
| 33 | +- Restart SmallBASIC and then click "About". You should see: "Extension modules: enabled". |
| 34 | +- If you have enabled Android developer options, make sure USB debugging is disabled. |
| 35 | +- On your IOIO-OTG board, connect a power source to the VIN + GND. |
| 36 | + - IOIO should be powered by an external DC voltage source between 5V-15V. |
| 37 | + - 9V battery works well. |
| 38 | + - But it is better to connect a 5V power supply. |
| 39 | + - Instead of VIN + GND you can use the 2-pin JST Female Power Jack |
| 40 | +- Connect a USB cable between your mobile or tablet and the board (use the included red adaptor plus another cable). |
| 41 | +- You should see "IOIO Standard application - no installed apps". |
| 42 | +- Launch "led.bas" |
| 43 | +- You should see a prompt requesting permission for SmallBASIC to access the board. Click okay. |
| 44 | +- You should then see a toast message: IOIO board access permitted. |
| 45 | +- For this initial setup "led.bas" has now timed out. You should be able to re-launch "led.bas" for successful operation. |
| 46 | + |
| 47 | +You have to connect power to the board, because it will act as an host and it will charge your Android device. |
| 48 | + |
| 49 | +## Examples |
| 50 | + |
| 51 | +### Digital output |
| 52 | + |
| 53 | +#### LED |
| 54 | + |
| 55 | +[led.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/led.bas) |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +#### PWM |
| 60 | + |
| 61 | +[pwm.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/pwm.bas) |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +#### HD44780 text display |
| 66 | + |
| 67 | +[hd44780.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/hd44780.bas) |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +### Digital input |
| 72 | + |
| 73 | +[button.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/button.bas) |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +### Analog input |
| 78 | + |
| 79 | +[slider-pot.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/slider-pot.bas) |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +### I2C |
| 84 | + |
| 85 | +#### BH1750 - Ambient light sensor |
| 86 | + |
| 87 | +[bh1750.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/bh1750.bas) |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +#### BME280 - Temperature and humidity sensor |
| 92 | + |
| 93 | +[bme280.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/bme280.bas) |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +#### MPU6050 - Accelerometer, gyroscope and temperature sensor |
| 98 | + |
| 99 | +[mpu6050.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/mpu6050.bas) |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | +#### VEML6030 - Ambient-light sensor |
| 104 | + |
| 105 | +[veml6030.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/veml6030.bas) |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +#### SSD1306 - OLED with 128x64 monochrome pixels |
| 110 | + |
| 111 | +[ssd1306.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/ssd1306.bas) |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | +### SPI |
| 116 | + |
| 117 | +#### 1088AS - 8x8 dot matrix module |
| 118 | + |
| 119 | +[duino-1088as.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/duino-1088as.bas) |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | +#### ST7789 - TFT controller |
| 124 | + |
| 125 | +[st7789.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/st7789.bas) |
| 126 | + |
| 127 | +SPI is too slow on IOIO to drive a TFT display. |
| 128 | + |
| 129 | +#### ST7735 - TFT controller |
| 130 | + |
| 131 | +[st7735.bas](https://github.com/smallbasic/smallbasic.plugins/blob/master/ioio/samples/st7735s.bas) |
| 132 | + |
| 133 | +SPI is too slow on IOIO to drive a TFT display. |
0 commit comments