I think its more likely that I destroyed them not really a failure but the first one I bought from jaycon and I ordered a jst connector they had I hooked the jst pigtail to 12v from a cigarette light of a car and it lit up like a sparkler on the 4th of july. not sure if the pigtail red wire was actually + or if it was just too much power jaycon never replied. the 2nd the micro usb connector came off and the 3rd I havent managed to destroy yet.
all that aside im really enjoying the ioio and what im learning from it you made a really awesome device thanks.
my edit of main.xml seems good for what im trying to do but MainActivity.java is where im having trouble connecting the radiobuttons to pins. ive tried many different ways with mainactivity.java but i just dont know enough and my books cant get here fast enough. I know its ugly and probably all wrong and definately incomplete but heres what ive been basically copying and pasting and trying this morning.
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.ToggleButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
/**
* 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 ToggleButton button_;
private RadioGroup passseat;
private RadioGroup driverseat;
private RadioGroup daytimerunninglights;
private RadioGroup passengermirror;
private RadioGroup drivermirror;
private RadioButton radioBtn1;
private RadioButton radioBtn2;
private RadioButton radioBtn3;
/**
* 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);
button_ = (ToggleButton) findViewById(R.id.button);
// group1
addListenerRadioGroup1();
// group2
addListenerRadioGroup2();
// group3
addListenerRadioGroup3();
// group4
addListenerRadioGroup4();
// group5
addListenerRadioGroup5();
}
/**
* 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. */
private DigitalOutput led_;
/**
* 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);
}
/**
* 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(!button_.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();
}
}
<?xml version="1.0" encoding="utf-8"?>
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/RadioGroup1Button0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Off" />
<RadioButton
android:id="@+id/RadioGroup1Button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Low" />
<RadioButton
android:id="@+id/RadioGroup1Button2"
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/RadioGroup2Button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Off" />
<RadioButton
android:id="@+id/RadioGroup2Button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Low" />
<RadioButton
android:id="@+id/RadioGroup2Button3"
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/radioGroup3Button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Off" />
<RadioButton
android:id="@+id/RadioGroup3Button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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/RadioGroup4Button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Off" />
<RadioButton
android:id="@+id/RadioGroup4Button2"
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/RadioGroup5Button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Off" />
<RadioButton
android:id="@+id/RadioGroup5Button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="On" />
</RadioGroup>
<ToggleButton android:text="ToggleButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button"></ToggleButton>
</LinearLayout>