打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
#lastpost
CLOUD9 IDE(http://www.c9.io/)是一个在线的同时兼容JavaScript和Node.js应用程序,以及HTML,CSS,PHP,Java中,Ruby和其他23种语言的开发环境。

我们建议,云9 IDE在容量大于4GB的SD卡上运行。关于如何从NAND到SD记忆卡迁移程序/数据,请参阅第2章。

安装所需要的软件包
  1. $ sudo apt-get install git libssl-dev python-software-properties
复制代码
建立nodejs(IDE CLOUD9需要)
  1. $ git clone git://github.com/joyent/node.git
  2. $ cd node
  3. $ git checkout v0.8.22
  4. $ make
  5. $ sudo make install
复制代码
安装nodejs后,可以直接删除资源,以节省空间。

编译CLOUD9 IDE
  1. $ git clone https://github.com/ajaxorg/cloud9.git
  2. $ cd cloud9/
  3. $ npm install
复制代码
CLOUD9运行在pcDuino
  1. $ ./bin/cloud9.sh -l 0.0.0.0
复制代码
如果你打算在pcDuino上运行,请在pcDuino上使用Chrome浏览器,并指向http://127.0.0.1:3131/

如果你要在PC或其他设备上运行,请在pcDuino上使用Chrome浏览器,并指向到http://board-ip-address:3131。pcDuino的IP地址可以用一下命令来获得:
  1. $ ifconfig
复制代码
在CLOUD9 IDE上运行js测试代码

在CLOUD9 IDE上运行js代码很容易。
只要写好代码(例如blink_led.js),然后点击菜单栏上的“运行”按钮。

以下为在pcDuino上运行的截图:



在PC上远程访问的截图:


示例代码如下:

blink_led.js:
  1. /**
  2. * blink_led.js, simple node.js test code for pcduino (http://www.pcduino.com)
  3. * base on the source code from https://github.com/jheising/node.pcduino.git
  4. */

  5. var fs = require('fs');
  6. var led_pin;

  7. var INPUT = 0;
  8. var OUTPUT = 1;
  9. var LOW = 0;
  10. var HIGH = 1;

  11. function digitalWrite(pin, value)
  12. {
  13. fs.writeFileSync("/sys/devices/virtual/misc/gpio/mode/gpio" + pin, String(value));
  14. }

  15. function pinMode(pin, mode)
  16. {
  17. fs.writeFileSync("/sys/devices/virtual/misc/gpio/mode/gpio" + pin, String(mode));
  18. }

  19. function delay(ms)
  20. {
  21. var start = new Date().getTime();
  22. for (var i = 0; i < 1e7; i++)
  23. if ((new Date().getTime() - start) > ms) break;
  24. }

  25. function setup()
  26. {
  27. led_pin = 18;
  28. pinMode(led_pin, OUTPUT);
  29. }

  30. function loop()
  31. {
  32. digitalWrite(led_pin, HIGH);
  33. delay(1000);
  34. digitalWrite(led_pin, LOW);
  35. delay(1000);
  36. }

  37. function main()
  38. {
  39. setup();
  40. while(1)
  41. {
  42. loop();
  43. }
  44. }

  45. main();
复制代码
在CLOUD9 IDE上运行C / C + +程序

运行C / C ++和从终端运行一个程序几乎是相同的。
首先写代码(例如00.pcDuino/blink_led.c)。
从命令输入框(CLOUD9 IDE的底部)运行以下命令:
  1. cd 00.pcDuino/
  2. g++ blink_led.c -larduino -I/usr/include/pcduino -o blink_led
  3. ./blink_led
复制代码
示例代码如下:

blink_led.c
  1. #include
  2. int led_pin=18;
  3. void setup()
  4. {
  5. pinMode(led_pin, OUTPUT);
  6. }

  7. void loop()
  8. {
  9. digitalWrite(led_pin, HIGH);
  10. delay(100);
  11. digitalWrite(led_pin, LOW);
  12. delay(100);
  13. }
复制代码
到这里我们惊喜地发现,我们再也不用把板子放到电脑旁边来调试代码了,也不用通过VNC的方式。 我们可以轻松地在ipad上面,远程对在现场的机器人或者其他项目实时地改动代码。





本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Ace is an embeddable code editor written in JavaScript
【腾讯云 Cloud Studio 实战训练营】在Cloud Studio上使用React实现学生管理系统
使用Cloud Studio&Flutter完成全平台博客网站的搭建
定制microBlocks物理实验专用版(3)
SAP Cloud for Customer Cloud(C4C)Application Studio里的代码调试
如果你还不会用git回滚代码,那你一定要来看看
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服