Kit IoT Wearable iOS http://iot.telefonicabeta.com/kit-iot-wearable
用于通过蓝牙连接到 可穿戴 IoT 开发套件 的 iOS 库。
链接 - 下载 sketch 并使用 Arduino IDE 上传到您的 Wearable Kit。
在 DevicesVC.h 中有一个 UITableView 显示从蓝牙设备 NSMutableArray
收集到的数据。连接和发送数据的一个示例
在 UITableView 的 delegate 中
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
DevicesVC.m
{
[...]
ViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"XPTO"];
controller.iotKit = kitIoT;
[self.navigationController pushViewController:controller animated:YES];
}
ViewController.m
@interface ViewController ()
@property (strong, nonatomic) IOTArduino *iotKit;
@end
@implementation ViewController
@synthesize iotKit;
//Exemplo, deixar o LED RGB AZUL
- (void)sendToArduino {
[iotKit sendCommandToArduino:@"#LR0000"];
[iotKit sendCommandToArduino:@"#LG0000"];
[iotKit sendCommandToArduino:@"#LB0255"];
}
查看蓝牙模块 HM-13 的文档 - 链接
查看命令列表 这里
ezefranca |