本文整理汇总了Java中ioio.lib.api.IOIO类的典型用法代码示例。如果您正苦于以下问题:Java IOIO类的具体用法?Java IOIO怎么用?Java IOIO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOIO类属于ioio.lib.api包,在下文中一共展示了IOIO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnect
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public void onConnect(Object obj) {
this.mIoio = (IOIO) obj;
MLog.d(TAG, "MOIO Connected");
if (mIoioCallbackfn != null) {
mIoioCallbackfn.event();
}
mIoioStarted = true;
mHandler.post(new Runnable() {
@Override
public void run() {
}
});
}
示例2: setStatusText
import ioio.lib.api.IOIO; //导入依赖的package包/类
public void setStatusText(final String str,final Status which,final boolean goodNews) {
runOnUiThread(new Runnable() {
@Override
public void run() {
TextView statView=null;
switch(which){
case NETWORK:
statView = networkStatus;
break;
case IOIO:
statView = IOIOstatus;
break;
}
if(statView==null)
return;
statView.setText(str);
if(goodNews)
statView.setBackgroundColor(getResources().getColor(R.color.online));
else
statView.setBackgroundColor(getResources().getColor(R.color.offline));
}
});
}
示例3: createIOIOLooper
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
protected IOIOLooper createIOIOLooper() {
return new BaseIOIOLooper() {
private DigitalOutput led_;
@Override
protected void setup() throws ConnectionLostException,
InterruptedException {
led_ = ioio_.openDigitalOutput(IOIO.LED_PIN);
}
@Override
public void loop() throws ConnectionLostException,
InterruptedException {
led_.write(false);
Thread.sleep(500);
led_.write(true);
Thread.sleep(500);
}
};
}
示例4: createIOIOLooper
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public IOIOLooper createIOIOLooper(String connectionType, Object extra) {
return new BaseIOIOLooper() {
private DigitalOutput led_;
@Override
protected void setup() throws ConnectionLostException,
InterruptedException {
led_ = ioio_.openDigitalOutput(IOIO.LED_PIN, true);
}
@Override
public void loop() throws ConnectionLostException,
InterruptedException {
led_.write(!ledOn_);
Thread.sleep(10);
}
};
}
示例5: close
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
synchronized public void close() {
super.close();
incoming_.close();
outgoing_.close();
ioio_.closeUart(uartNum_);
if (rxPinNum_ != IOIO.INVALID_PIN) {
ioio_.closePin(rxPinNum_);
}
if (txPinNum_ != IOIO.INVALID_PIN) {
ioio_.closePin(txPinNum_);
}
}
示例6: showVersions
import ioio.lib.api.IOIO; //导入依赖的package包/类
private void showVersions(IOIO ioio, String title) {
toast(String.format("%s\n" +
"IOIOLib: %s\n" +
"Application firmware: %s\n" +
"Bootloader firmware: %s\n" +
"Hardware: %s",
title,
ioio.getImplVersion(VersionType.IOIOLIB_VER),
ioio.getImplVersion(VersionType.APP_FIRMWARE_VER),
ioio.getImplVersion(VersionType.BOOTLOADER_VER),
ioio.getImplVersion(VersionType.HARDWARE_VER)));
}
示例7: setup
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public void setup(IOIO ioio_){
try {
analogInput = ioio_.openAnalogInput(sensorPin);
} catch (ConnectionLostException e) {
e.printStackTrace();
}
}
示例8: process
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public void process(IOIO ioio_) throws ConnectionLostException, InterruptedException {
trigger.setPulseWidth(8000);
distance = (echo.getDuration() * 1000 * 1000 ) / 29f / 2f;
if (distance>2 && distance < 700){
sendData(distance);
}
}
示例9: showVersions
import ioio.lib.api.IOIO; //导入依赖的package包/类
private void showVersions(IOIO ioio, String title) {
toast(String.format("%s\n" + "IOIOLib: %s\n"
+ "Application firmware: %s\n" + "Bootloader firmware: %s\n"
+ "Hardware: %s", title,
ioio.getImplVersion(VersionType.IOIOLIB_VER),
ioio.getImplVersion(VersionType.APP_FIRMWARE_VER),
ioio.getImplVersion(VersionType.BOOTLOADER_VER),
ioio.getImplVersion(VersionType.HARDWARE_VER)));
}
示例10: setup
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public void setup() throws ConnectionLostException {
led_ = ioio_.openDigitalOutput(IOIO.LED_PIN, true);
input_ = ioio_.openAnalogInput(40);
pwmOutput_ = ioio_.openPwmOutput(12, 100);
enableUi(true);
}
示例11: Helper
import ioio.lib.api.IOIO; //导入依赖的package包/类
public Helper(IOIO _ioio, KrypgrundsService kryp, String id, String ver, ServiceMode mode) {
ioio = _ioio;
krypService = kryp;
imei = id;
version = ver;
mCtx = kryp.getApplicationContext();
if (ioio != null) {
try {
// if (mode == ServiceMode.Survfind) {
anemometer = ioio.openAnalogInput(ANEMOMETER_WIND_VANE);
if (GET_SPEED_VERSION == FrequencyReading.Analogue_Reading) {
mAnalogPulsecounter = ioio.openAnalogInput(ANEMOMETER_SPEED);
} else if (GET_SPEED_VERSION == FrequencyReading.Continuos_Reading) {
Spec spec = new Spec(ANEMOMETER_SPEED);
spec.mode = Mode.PULL_UP;
pulseCounter = ioio.openPulseInput(spec, ClockRate.RATE_16MHz, PulseMode.FREQ, true);
} else if (GET_SPEED_VERSION == FrequencyReading.OpenClose_Reading) {
// Do nothing as open and close will be done at every
// call.
}
// } else if (mode == ServiceMode.Krypgrund) {
i2cInne = ioio.openTwiMaster(2, TwiMaster.Rate.RATE_100KHz, false);
i2cUte = ioio.openTwiMaster(1, TwiMaster.Rate.RATE_100KHz, false);
// }
// On board sensors. Are they used?
power = ioio.openAnalogInput(42);
B2 = ioio.openDigitalOutput(20);
B1 = ioio.openDigitalOutput(19);
B1.write(mFanOn);
B2.write(mFanOn);
} catch (Exception e) {
e.printStackTrace();
} // USE FALSE for I2C otherwise to high voltage!!!
}
}
示例12: get
import ioio.lib.api.IOIO; //导入依赖的package包/类
public IOIO get() {
return mIoio;
}
示例13: setup
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public final void setup(IOIO ioio) throws ConnectionLostException,
InterruptedException {
ioio_ = ioio;
setup();
}
示例14: setup
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public final void setup(IOIO ioio) throws ConnectionLostException,
InterruptedException {
ioio_ = ioio;
setup();
}
示例15: incompatible
import ioio.lib.api.IOIO; //导入依赖的package包/类
@Override
public final void incompatible(IOIO ioio) {
ioio_ = ioio;
incompatible();
}