>
> its amazing how much this one sentence helped me "what you want to do is 
> simply open more digital outputs from your setup() method and then write() 
> to them in your loop() method, just like it is done with the on-board LED" 
> from that tip i came up with what i beleive is working code.
>
Thanks
Ryan 



MainActvity.java

package ioio.examples.hello;

import ioio.lib.api.DigitalOutput;
import ioio.lib.api.exception.ConnectionLostException;
import ioio.lib.util.BaseIOIOLooper;
import ioio.lib.util.IOIOLooper;
import ioio.lib.util.android.IOIOActivity;
import android.os.Bundle;
import android.widget.RadioButton;

/**
 * This is the main activity of the HelloIOIO example application.
 * 
 * It displays a toggle Button on the screen, which enables control of the
 * on-board LED. This example shows a very simple usage of the IOIO, by 
using
 * the {@link IOIOActivity} class. For a more advanced use case, see the
 * HelloIOIOPower example.
 */
public class MainActivity extends IOIOActivity {
private RadioButton Button0;
private RadioButton Button1;
private RadioButton Button2;
private RadioButton Button3;
private RadioButton Button4;
private RadioButton Button5;
private RadioButton Button6;
private RadioButton Button7;
private RadioButton Button8;
private RadioButton Button9;
private RadioButton Button10;
private RadioButton Button11;
private RadioButton Button12;
/**
 * Called when the activity is first created. Here we normally initialize
 * our GUI.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button0 = (RadioButton) findViewById(R.id.Button0);
Button1 = (RadioButton) findViewById(R.id.Button1);
Button2 = (RadioButton) findViewById(R.id.Button2);
Button3 = (RadioButton) findViewById(R.id.Button3);
Button4 = (RadioButton) findViewById(R.id.Button4);
Button5 = (RadioButton) findViewById(R.id.Button5);
Button6 = (RadioButton) findViewById(R.id.Button6);
Button7 = (RadioButton) findViewById(R.id.Button7);
Button8 = (RadioButton) findViewById(R.id.Button8);
Button9 = (RadioButton) findViewById(R.id.Button9);
Button10 = (RadioButton) findViewById(R.id.Button10);
Button11 = (RadioButton) findViewById(R.id.Button11);
}

/**
 * This is the thread on which all the IOIO activity happens. It will be run
 * every time the application is resumed and aborted when it is paused. The
 * method setup() will be called right after a connection with the IOIO has
 * been established (which might happen several times!). Then, loop() will
 * be called repetitively until the IOIO gets disconnected.
 */
class Looper extends BaseIOIOLooper {
/** The on-board LED and pins */
private DigitalOutput led_;
private DigitalOutput pin1;
private DigitalOutput pin2;
private DigitalOutput pin3;
private DigitalOutput pin4;
private DigitalOutput pin5;
private DigitalOutput pin6;
private DigitalOutput pin7;
private DigitalOutput pin8;
private DigitalOutput pin9;
private DigitalOutput pin10;
private DigitalOutput pin11;
private DigitalOutput pin12;
/**
 * Called every time a connection with IOIO has been established.
 * Typically used to open pins.
 * 
 * @throws ConnectionLostException
 *             When IOIO connection is lost.
 * 
 * @see ioio.lib.util.AbstractIOIOActivity.IOIOThread#setup()
 */
@Override
protected void setup() throws ConnectionLostException {
led_ = ioio_.openDigitalOutput(0, true);
pin1 = ioio_.openDigitalOutput(1, true);
pin2 = ioio_.openDigitalOutput(2, true);
pin3 = ioio_.openDigitalOutput(3, true);
pin4 = ioio_.openDigitalOutput(4, true);
pin5 = ioio_.openDigitalOutput(5, true);
pin6 = ioio_.openDigitalOutput(6, true);
pin7 = ioio_.openDigitalOutput(7, true);
pin8 = ioio_.openDigitalOutput(8, true);
pin9 = ioio_.openDigitalOutput(9, true);
pin10 = ioio_.openDigitalOutput(10, true);
pin11 = ioio_.openDigitalOutput(11, true);
pin12 = ioio_.openDigitalOutput(12, true);
}

/**
 * Called repetitively while the IOIO is connected.
 * 
 * @throws ConnectionLostException
 *             When IOIO connection is lost.
 * 
 * @see ioio.lib.util.AbstractIOIOActivity.IOIOThread#loop()
 */
@Override
public void loop() throws ConnectionLostException {
led_.write(!Button11.isChecked());
pin1.write(Button1.isChecked());
pin2.write(Button2.isChecked());
pin3.write(Button3.isChecked());
pin4.write(Button4.isChecked());
pin5.write(Button5.isChecked());
pin6.write(Button6.isChecked());
pin7.write(Button7.isChecked());
pin8.write(Button8.isChecked());
pin9.write(Button9.isChecked());
pin10.write(Button10.isChecked());
pin11.write(Button11.isChecked());
pin12.write(Button12.isChecked());
 try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
}

/**
 * A method to create our IOIO thread.
 * 
 * @see ioio.lib.util.AbstractIOIOActivity#createIOIOThread()
 */
@Override
protected IOIOLooper createIOIOLooper() {
return new Looper();
}
} 


main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    

<RadioGroup
    android:id="@+id/RadioGroup1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/textView1"
    android:layout_marginTop="0dp"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/TextView1"
        android:layout_width="217dp"
        android:layout_height="wrap_content"
        android:text="Driver Seat"
        android:textAppearance="?android:attr/textAppearanceMedium" />

        <RadioButton
            android:id="@+id/Button0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="Off" />

        <RadioButton
            android:id="@+id/Button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Low" />

        <RadioButton
            android:id="@+id/Button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="High" />
    </RadioGroup><RadioGroup
        android:id="@+id/RadioGroup2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/radioGroup1"
        android:orientation="horizontal"
        android:layout_marginRight="15dp" >

        <TextView
            android:id="@+id/TextView2"
            android:layout_width="217dp"
            android:layout_height="wrap_content"
            android:text="Passenger Seat"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <RadioButton
            android:id="@+id/Button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="Off" />

        <RadioButton
            android:id="@+id/Button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Low" />

        <RadioButton
            android:id="@+id/Button5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="High" />
    </RadioGroup>
    <RadioGroup
        android:id="@+id/RadioGroup3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/RadioGroup3"
        android:orientation="horizontal"
        android:layout_marginRight="15dp" >

        <TextView
            android:id="@+id/textView3"
            android:layout_width="217dp"
            android:layout_height="wrap_content"
            android:text="Daytime Running Lamps"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <RadioButton
            android:id="@+id/Button6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
                        android:text="Off" />

        <RadioButton
            android:id="@+id/Button7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="On" />

   
    </RadioGroup>

    <RadioGroup
        android:id="@+id/RadioGroup4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="15dp"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/TextView4"
            android:layout_width="217dp"
            android:layout_height="wrap_content"
            android:text="Drivers Mirror"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <RadioButton
            android:id="@+id/Button8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="Off" />

        <RadioButton
            android:id="@+id/Button9"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="On" />
    </RadioGroup>

    <RadioGroup
        android:id="@+id/RadioGroup5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="15dp"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/TextView5"
            android:layout_width="217dp"
            android:layout_height="wrap_content"
            android:text="Passenger Mirror"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <RadioButton
            android:id="@+id/Button10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="Off" />

        <RadioButton
            android:id="@+id/Button11"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="On" />
    </RadioGroup>


</LinearLayout>

>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to