Fel*_*ros 1 c android arduino adk
我正在尝试从我的Arduino Mega ADK到我的Android开始连接,但每当我尝试acc.powerOn()时我都会收到以下错误
错误:OSCOKIRQ无法断言
这是我正在尝试运行的固件:
#include <Wire.h>
#include <Servo.h>
#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>
int led = 13;
int EnableMotors = 22;
int Motor1FW = 24;
int Motor1RW = 26;
int Motor2FW = 28;
int Motor2RW = 30;
AndroidAccessory acc("FRBB",
"UgvBr",
"DemoKit Arduino Board",
"1.0",
"http://www.android.com",
"0000000012345678");
// the setup routine runs once when you press reset:
void setup() {
// Setting Serial at 115200 bps
Serial.begin(115200);
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
// Set up motor configs
pinMode(EnableMotors, OUTPUT);
pinMode(Motor1FW, OUTPUT);
pinMode(Motor1RW, OUTPUT);
pinMode(Motor2FW, OUTPUT);
pinMode(Motor2RW, OUTPUT);
// Powering the accessory
acc.powerOn(); ///// <<<<<<<<<<< ERROR
}
// the loop routine runs over and over again forever:
void loop() {
if(acc.isConnected()){
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(EnableMotors, HIGH);
digitalWrite(Motor1FW, HIGH);
digitalWrite(Motor2FW, HIGH);
delay(2000);
digitalWrite(led, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(EnableMotors, LOW);
digitalWrite(Motor1FW, LOW);
digitalWrite(Motor2FW, LOW);
delay(2000);
}
}
Run Code Online (Sandbox Code Playgroud)
我一直在寻找各地,我找不到解决这个问题的方法.我也在1.0.1上尝试使用Arduino.app的DemoKit,但仍然是同样的问题.我正在使用Mac开发它,但我不认为这是一个问题.
出于测试目的,我上传了一个代码来闪烁LED,它运行得很好.
花了8个小时才遇到完全相同的问题.好像Max3421e.cpp有问题.尝试更换:
boolean MAX3421E::reset()
{
byte tmp = 0;
regWr( rUSBCTL, bmCHIPRES ); //Chip reset. This stops the oscillator
regWr( rUSBCTL, 0x00 ); //Remove the reset
while(!(regRd( rUSBIRQ ) & bmOSCOKIRQ )) { //wait until the PLL is stable
tmp++; //timeout after 256 attempts
if( tmp == 0 ) {
return( false );
}
}
return( true );
}
Run Code Online (Sandbox Code Playgroud)
同
boolean MAX3421E::reset()
{
regWr( rUSBCTL, bmCHIPRES ); //Chip reset. This stops the oscillator
regWr( rUSBCTL, 0x00 ); //Remove the reset
while(!(regRd(rUSBIRQ) & bmOSCOKIRQ)) ;
}
Run Code Online (Sandbox Code Playgroud)
在Max3421e.cpp中,位于USB_Host_Shield库中(在Arduino IDE库文件夹中).基本上,在PLL真正稳定之前,更改不允许退出.
至少为我工作,祝你好运(原始提示以及有关修复的更多内容:http://arduino.cc/forum/index.php?topic = 68205.0)
| 归档时间: |
|
| 查看次数: |
4641 次 |
| 最近记录: |