Remove everything that's not related to the actual problem you reported and
try again. Look at the logcat output for any errors.
On May 23, 2014 9:02 PM, "jack" <[email protected]> wrote:
> sorry, i did't make it clear.
> i had used helloioio for testing , it's work.
> my question is ,when i set pin41 → ain1_ = ioio_.openDigitalOutput(41,
> true); it should output 3.3v in pin41 , but it only output 0.02v or less.
>
> is it possible the liberty version doesn't match to ioio-otg
>
>
> and this is my source code
>
> package ioio;
>
> import com.example.ioio.R;
>
> import ioio.lib.api.DigitalOutput;
> import ioio.lib.api.DigitalOutput.Spec.Mode;
> import ioio.lib.api.PwmOutput;
> 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.view.View;
> import android.view.View.OnClickListener;
> import android.widget.EditText;
> import android.widget.TextView;
> import android.widget.Button;
>
>
>
> public class MainActivity extends IOIOActivity{
>
> private static final int PWM_FREQ = 100;
>
> private float left_ = 0;
> private float right_ = 0;
>
>
> Button forward,backward,left,right,stop;
>
>
> public void onCreate(Bundle savedInstanceState){
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> forward = (Button)findViewById(R.id.forward);
> backward = (Button)findViewById(R.id.backward);
> left = (Button)findViewById(R.id.left);
> right = (Button)findViewById(R.id.right);
> stop = (Button)findViewById(R.id.stop);
> }
>
>
>
>
>
>
>
> class Looper extends BaseIOIOLooper{
> private DigitalOutput ain1_;
> private DigitalOutput ain2_;
> private PwmOutput pwma_;
> private PwmOutput pwmb_;
> private PwmOutput led_;
> private DigitalOutput bin2_;
> private DigitalOutput bin1_;
> private DigitalOutput stby_;
> final TextView xView = (TextView) findViewById(R.id.a);
> protected void setup() throws ConnectionLostException {
> ain1_ = ioio_.openDigitalOutput(41, false);
> ain2_ = ioio_.openDigitalOutput(40, false);
> pwma_ = ioio_.openPwmOutput(new DigitalOutput.Spec(39,
> Mode.OPEN_DRAIN), PWM_FREQ);
> pwmb_ = ioio_.openPwmOutput(new
> DigitalOutput.Spec(45,Mode.OPEN_DRAIN), PWM_FREQ);
>
>
> bin2_ = ioio_.openDigitalOutput(44,, false);
> bin1_ = ioio_.openDigitalOutput(43,false);
> stby_ = ioio_.openDigitalOutput(42, false);
> stby_.write(true); // On
> led_ = ioio_.openPwmOutput(0,PWM_FREQ);
>
> forward.setOnClickListener(new OnClickListener(){
> public void onClick(View v){
> try{
> pwma_.setDutyCycle((float)1.0);
> ain1_.write(true);
> ain2_.write(false);
> pwmb_.setDutyCycle((float)1.0);
> bin1_.write(true);
> bin2_.write(false);
>
>
> }catch(ConnectionLostException e){
> e.printStackTrace();
>
> }
>
> }
> });
>
>
> backward.setOnClickListener(new OnClickListener(){
> public void onClick(View v){
> try{
> pwma_.setDutyCycle((float)1.0);
> ain1_.write(false);
> ain2_.write(true);
> pwmb_.setDutyCycle((float)1.0);
> bin1_.write(false);
> bin2_.write(true);
>
> }catch(ConnectionLostException e){
> e.printStackTrace();
>
> } }
> });
>
>
> left.setOnClickListener(new OnClickListener(){
> public void onClick(View v){
> try{
> pwma_.setDutyCycle((float)1.0);
> ain1_.write(true);
> ain2_.write(false);
> pwmb_.setDutyCycle((float)0.5);
> bin1_.write(true);
> bin2_.write(false);
>
> }catch(ConnectionLostException e){
> e.printStackTrace();
>
> }
>
> }
> });
>
> right.setOnClickListener(new OnClickListener(){
> public void onClick(View v){
> try{
> pwma_.setDutyCycle((float)0.5);
> ain1_.write(true);
> ain2_.write(false);
> pwmb_.setDutyCycle((float)1.0);
> bin1_.write(true);
> bin2_.write(false);
>
> }catch(ConnectionLostException e){
> e.printStackTrace();
>
> }
> }
> });
>
>
> stop.setOnClickListener(new OnClickListener(){
> public void onClick(View v){
> try{
> ain1_.write(false);
> ain2_.write(false);
> bin1_.write(false);
> bin2_.write(false);
>
> }catch(ConnectionLostException e){
> e.printStackTrace();
>
> }
> }
> });
>
>
>
> }
>
> public void loop() throws ConnectionLostException{
>
> try{
> Thread.sleep(50);
> }catch(InterruptedException e){
> e.printStackTrace();
>
>
>
> }
>
>
> }
>
> }
> protected IOIOLooper createIOIOLooper() {
> return new Looper();
> }
> }
>
>
>
>
>
> jack於 2014年5月24日星期六UTC+8上午10時56分56秒寫道:
>>
>> Hello, i'm trying to use IOIO-otg board drive DCmotor by driver tb6612fng.
>> Unfortunately,it didn't work,and i found that the pin didn't output
>> neither 3.3v nor 5v, i have no idea how to fix it.
>> Please help me!!!
>> Thank you very much!!
>>
>> And here is my source code,my IOIOlib is IOIO0503
>>
>> --
> 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.
>
--
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.