标签: arduino

Arduino C++代码:您可以使用虚函数和异常吗?

编写固件:汇编或高级别的问题开始对此评论进行跟进:

在为Arduino平台编译C++代码时,您可以使用虚函数,异常等吗?或者你想(必须)使用C++的一个子集(如评论所述)?

在为Arduino平台编程时还有其他注意事项吗?

c++ virtual-functions arduino firmware

15
推荐指数
2
解决办法
1万
查看次数

使用Xcode 5在Mac OS X上进行Arduino编程?

有关如何使用Xcode设置Arduino编程环境的良好参考吗?

一个理想的答案是:"哦,是的,Google代码上有一个活跃的项目,只需下载.dmg,将$ {Xcode魔法配置文件}复制到〜{库中某处}},重启Xcode并选择从File菜单中选择"New Arduino Project".单击Build并插入Arduino,然后将其直接上传到硬件."

谷歌提供了几个点击,但它们有点模糊和过时(具体来说,Xcode在Xcode 3和4之间改变项目模板的方式,我找不到Xcode 4模板.)我已经正式过时的加工,如果可能的话,我宁愿不用Eclipse破坏我的家庭生活.

macos arduino xcode4

15
推荐指数
2
解决办法
4264
查看次数

Arduino Mega ADK初学者教程

有没有人知道用手机控制Arduino Mega ADK的好介绍?我想做的就是使用一个非常基本的拨动开关应用控制引脚13上的LED.

编辑26/10/11:

http://labs.arduino.cc/ADK/Index

http://jeffreysambells.com/posts/2011/05/17/understanding-the-demokit-pde-arduino-sketch/

https://github.com/deadfalkon/HelloADK

现在我遇到了让我的Galaxy S2以配件模式连接的问题......

编辑27/10/11

http://sgccare.blogspot.com/2011/10/first-arduino-and-android-setup.html

android arduino adk

15
推荐指数
2
解决办法
2万
查看次数

杀死设备或资源繁忙的进程:'/ dev/ttyUSB0'?

我使用以下Python代码连接到我的Arduino板.

device=glob.glob("/dev/ttyUSB*")[0]
time.sleep(1)
arduino = serial.Serial(device, 115200, timeout=5)
Run Code Online (Sandbox Code Playgroud)

它通常可以工作,但不知何故,一些其他进程必须在重新启动后访问板,从而给出错误

serial.serialutil.SerialException:无法打开端口/ dev/ttyUSB0:[Errno 16]设备或资源忙:'/ dev/ttyUSB0'

当拔出并重新插入USB插件时,我可以正常执行Python代码,而不会发生错误.如何避免阻止端口的任何其他进程?我如何找出出现此错误的原因?

python serial-port arduino pyserial

15
推荐指数
2
解决办法
2万
查看次数

在Arduino中尝试/捕获块

我正在使用Arduino中的套接字通信,我需要try/catch块来正确处理,你们有什么建议?我在互联网上的搜索没有成功.

编辑:

我正在使用的代码使用WiFly模块与移动应用程序进行交互,我正在使用Android构建一个机器人模块,其中包含对移动应用程序的一些控制.一切正常,但有时套接字断开连接,所以我需要为这种情况添加处理,类似于try/catch块,但我没有找到类似的Arduino块.

我的代码:

void loop() {
    Client client = server.available();
    if (client) {
        while (client.connected()) {
            if (client.available()) {
                // Serial.print("client connected \n");
                char c = client.read();

                if(c == 'L')
                    turnLeft();
                if(c == 'R')
                    turnRight();
                if(c == 'F')
                    goForward();
                if(c == 'B')
                    goBackward();
                if(c == 'S')
                    Stop();

                Serial.print(c);
            }
        }

        // give the web browser time to receive the data
        delay(100);
        client.stop();
    }
}
Run Code Online (Sandbox Code Playgroud)

arduino try-catch

15
推荐指数
2
解决办法
4万
查看次数

在Arduino中使用谷歌的"协议缓冲区"

是否有可能使Google 协议缓冲区在Arduino中运行?

我已经尝试了大约一个星期但无法使其工作,我想知道它是否可能.

avr arduino protocol-buffers

15
推荐指数
1
解决办法
8737
查看次数

Arduino上的HTTPS替代品

我正在考虑在我正在进行的项目中使用Arduino,但问题仍然存在.

Arduino将收集数据,偶尔会将它们发送到服务器.我希望能够保证数据传输.

我知道Arduino没有足够的处理能力来处理HTTPS加密,但我想知道是否可以在这里使用一个可靠的替代品.

你怎么看?

encryption https arduino

15
推荐指数
1
解决办法
1万
查看次数

使用Java控制Arduino

我希望用Java程序打开和关闭LED.我在大约5分钟内完成了C#中的项目,但在Java中似乎更具挑战性.我让Arduino等待1或0写入COM端口,并根据它改变LED.我用于Arduino的代码如下.

int LedPin = 13;
char data;

void setup()
{
    Serial.begin(9600);
    pinMode( LedPin , OUTPUT );
}

void loop()
{
    data = Serial.read();
    if (Serial.available() > 0)
    {
        if(data == '1' )
        {
            digitalWrite(LedPin,HIGH);
        }
        else if(data == '0' )
        {
            digitalWrite(LedPin,LOW);
        }
    }
    else
        if (Serial.available()<0)
        {
            digitalWrite(LedPin,HIGH);
            delay(500);
            digitalWrite(LedPin,LOW);
            delay(500);
        }
}
Run Code Online (Sandbox Code Playgroud)

我如何使用Java应用程序执行此操作?

java eclipse arduino jarduino

15
推荐指数
3
解决办法
6万
查看次数

Arduino - 乱码串行输出

我已经将ADH8066(Sparkfun)GSM模块连接到我的Arduino Uno,我正试图在Arduino和GSM模块之间进行正确的串行连接.当我直接(通过USB或只是TTL线)连接它时它工作正常,但是当通过Arduino控制时却没有.一些文本将正确输出,其余文本将出现乱码,几乎就像波特率错误一样,但我只是使用与从PC连接时相同的波特率(115200).

这是我正在使用的Arduino代码:

#include <SoftwareSerial.h>

#define rxPin 7
#define txPin 8
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

// EN: String buffer for the GPRS shield message
String SmsStorePos = String("");
String msg = String("");
String snTmp = String("");
String snFull = String("");

// EN: Set to 1 when the next GPRS shield message will contains the SMS message
int SmsContentFlag = 0;

// EN: Pin of the LED to turn ON and OFF depending on the received message
int ledPin = …
Run Code Online (Sandbox Code Playgroud)

serial-port arduino

15
推荐指数
2
解决办法
3万
查看次数

python到arduino串口读写

我试图在一些python代码和arduino代码之间来回"ping pong"信息.我想定期向arduino代码发送两个设定值(例如在分钟上),在arduino和更新变量上读取它们,然后定期将状态信息从arduino发送回python(例如:30秒).最终python将从mySQL db(后来的dev)发送和提取信息.

现在我无法让信息可靠地来回反弹.我在搜索中没有发现任何与此相近的内容,我尝试修改的所有内容都无效.我最近的就是这个(它实际上并没有在发送和接收之间来回切换):

蟒蛇

#!/usr/bin/python
import serial
import syslog
import time

#The following line is for serial over GPIO
port = '/dev/ttyS0'


ard = serial.Serial(port,9600,timeout=5)

i = 0

while (i < 4):
    # Serial write section

    setTempCar1 = 63
    setTempCar2 = 37
    ard.flush()
    setTemp1 = str(setTempCar1)
    setTemp2 = str(setTempCar2)
    print ("Python value sent: ")
    print (setTemp1)
    ard.write(setTemp1)
    time.sleep(4)

    # Serial read section
    msg = ard.readline()
    print ("Message from arduino: ")
    print (msg)
    i = i + 1
else:
    print …
Run Code Online (Sandbox Code Playgroud)

python serial-port arduino

15
推荐指数
1
解决办法
9万
查看次数