File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
src/main/java/net/sourceforge/smallbasic/ioio Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 1+ import ioio
2+
3+ analogIn = ioio.openAnalogInput (46 )
4+
5+ print " wait for connect"
6+ ioio.waitForConnect ()
7+ print " ready!!!"
8+
9+ while 1
10+ print analogIn.read ()
11+ delay 100
12+ wend
13+
14+ print " done"
15+
16+
17+
Original file line number Diff line number Diff line change 1212
1313public class IOService implements IOIOLooperProvider {
1414 private static final String TAG = "IOService" ;
15- private static final int MAX_PINS = 43 ;
15+ private static final int MAX_PINS = 46 ;
1616 private static IOService instance = null ;
1717
1818 private final ConnectionController connectionController ;
@@ -24,7 +24,7 @@ private IOService() {
2424 connectionController = new ConnectionController (this );
2525 looper = new IOServiceLooper ();
2626 ioTasks = new ArrayList <>();
27- usedPins = new Boolean [MAX_PINS ];
27+ usedPins = new Boolean [MAX_PINS + 1 ];
2828 }
2929
3030 public static IOService getInstance () {
@@ -57,7 +57,7 @@ public void start() {
5757
5858 private void registerPin (int pin ) throws IOException {
5959 if (pin != -1 ) {
60- if (pin < 0 || pin >= MAX_PINS ) {
60+ if (pin < 0 || pin > MAX_PINS ) {
6161 throw new IOException ("invalid pin: " + pin );
6262 }
6363 if (usedPins [pin ] != null && usedPins [pin ]) {
@@ -88,6 +88,7 @@ public void incompatible(IOIO ioio) {
8888
8989 @ Override
9090 public void loop () throws ConnectionLostException , InterruptedException {
91+ Thread .sleep (100 );
9192 for (IOTask next : ioTasks ) {
9293 next .loop ();
9394 }
You can’t perform that action at this time.
0 commit comments