stickOS & cui32stem

http://www.seeedstudio.com/depot/customize-your-grove-kit-p-931.html?cPath=138

http://cpustick.com/stickos.htm

 

基于PIC的控制系统,内置StickOS,支持串口连接直接basic编程(这个比arduinoIDE响应快速得多,而且能看到源码),兼容arduino

 

闪个灯,led插在电池口旁边的Gnd和D0上,

 

  10 dim led as pin rd0 for analog output
  20 dim fade
  30 let led = 1000
  40 let fade = 1
  50 while 1 do
  60   if led>=1000||led<=0 then
  70     let fade = fade*-1
  80   endif
  90   let led = led+fade*10
 100   sleep 10 ms
 110 endwhile
  

 

i2c三轴加速器模块

http://www.seeedstudio.com/wiki/Grove_-_I2C_3-axis_Accelerometer

 

  10 dim acc
  20 let acc = 0x4c
  30 dim MODE as byte, MODE_STANDBY as byte, MODE_ACTIVE as byte
  40 let MODE = 0x7, MODE_STANDBY = 0x0, MODE_ACTIVE = 0x1
  50 dim SR as byte, config as byte
  60 let SR = 0x8, config = 0x7
  70 i2c start acc
  80 i2c write MODE, MODE_STANDBY
  90 i2c write SR, config
 100 i2c write MODE, MODE_ACTIVE
 110 dim rsp[3] as byte, x[6] as short
 120 while 1 do
 130   i2c read rsp
 140   i2c stop
 150   let x[0] = rsp[0]&0x20>>5, x[1] = rsp[0]&0x1f
 160   let x[2] = rsp[1]&0x20>>5, x[3] = rsp[1]&0x1f
 170   let x[4] = rsp[2]&0x20>>5, x[5] = rsp[2]&0x1f
 180   print x
 190   sleep 1000 ms
 200 endwhile

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值