我是c编程的新手,并试图比较IR HEX字符串.我收到错误:左值作为左操作数的赋值.
我的问题是我的问题是在第31行.这是代码:
/* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
String stringAppleUp;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
Serial.println ("See it");
stringAppleUp = string('77E150BC'); //apple remote up button
if ( ???? …Run Code Online (Sandbox Code Playgroud) 我是一个arduino新手,我想为我的论文建立一个网络项目.我使用arduino uno作为微控制器,DHT11用于温度传感器,Enc28j60用于以太网屏蔽.该项目用于控制LED并通过网站监控温度和湿度.我想将arduino设置为客户端.我想在局域网模式下模拟这个项目.我想问一下:1.如何将arduino设置为客户端?2.如何从arduino接收温度数据并将其存储到数据库(mysql)?3.如何通过网站控制led?
我曾尝试将arduino作为服务器,并且它成功了.但我混淆了如何设置为客户端谢谢你,
有人可以帮帮我吗?
我正在查看示例代码并发现此操作:
displayMap[x + (y/8)*LCD_WIDTH]|= 1 (shift by) shift;
Run Code Online (Sandbox Code Playgroud)
在哪里
byte shift = y % 8;
Run Code Online (Sandbox Code Playgroud)
我理解|操作数,=但是它们两个一起做什么。
我想为 SSD1306 创建一个简单的 Linux 驱动程序,我已通过 I\xc2\xb2C 连接到我的 Raspberry Pi。
\n\n在开始编码之前,我想了解设备以及我必须发送哪些命令。我使用 Linux 的 i2c-tools 来测试我的命令。我研究了一些Arduino项目和SSD1306的数据表,但我只能在命令行上重新创建一些命令:
\n\n初始化设备:i2cset -y 1 0x3c 0xAE 0x20 0x10 0xb0 0xc8 0x00 0x10 0x40 0x81 0x7f 0xa1 0xa6 0xa8 0x3f 0xa4 0xd3 0x00 0xd5 0xf0 0xd9 0x22 0xda 0x12 0xdb 0x20 0x8d 0x14 0xaf i
将数据发送到设备内存:i2cset -y 1 0x3c 0x40 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF i\n这将从当前位置向右填充一些像素。
跳转到左上角像素:i2cset -y 1 0x3c 0xb0 0x00 0x10 i …
我有三个图形:一个立方体、一个八面体、一个十二面体。
每个人物内部都有一个加速度计。
图形的边编号在 1 到 n 之间。
任务:确定立方体、八面体、十二面体的当前边长。
对于立方体,我推导出公式:
边=圆形((Ax*1/988)+(Ay*2/988)+(Az*3/988));
变量“side”将给出区间 -3 和 3 之间的值(不带 0),这意味着立方体的当前边在 1 到 6 之间。
现在我需要对八面体和十二面体执行相同的操作。求助,我该怎么办?我是否需要额外的传感器或加速度计就足够了?
我正在编程一个锁,在哪里解锁它你必须在键盘中插入一个 PIN 码。我有以下变量:
char password_init[4] = {'1', '2', '3', '4'}; //initial password
char password[4];
Run Code Online (Sandbox Code Playgroud)
当用户按下键盘上的某个键时,该数字将存储在变量中,password并且在用户按下 4 位数字后,将比较两个变量,以确定是否可以访问锁定。
我发现这样做的一种解决方案是使用 strncmp() 函数:
if (!(strncmp(password, password_init, 4))){
Serial.println("PIN Code correct");
}
Run Code Online (Sandbox Code Playgroud)
这有效,但我不明白为什么我应该使用!(strncmo())而不是strncmo(). 如果我使用if (strncmp(password, password_init, 4)),结果将是错误的 PIN 码。
该strncmp()函数逐个字符地比较两个字符串,所以有人可以解释我为什么必须以否定方式使用它来代替初始密码和用户在键盘匹配中按下的密码吗?
我需要在 Arduino 或 Raspberrypi 板上每秒生成 6 亿次脉冲。我的目的是测量发射器和接收器之间的距离。接收器每秒对接收到的脉冲进行计数并估计距离。我可以用哪些方式编写代码?
我有一个基类和派生类:
plugin.h
#ifndef PLUGIN_H
#define PLUGIN_H
// plugin states
#define PLUGIN_IDLE 0
class Plugin {
public:
Plugin();
~Plugin();
virtual void loop();
};
#endif
Run Code Online (Sandbox Code Playgroud)
plugin.cpp
#include <Arduino.h>
#include "plugin.h"
Plugin::Plugin() {
}
Plugin::~Plugin(){
}
void Plugin::loop(){
Serial.println("Plugin::loop()");
}
Run Code Online (Sandbox Code Playgroud)
派生类
class OneWirePlugin : public Plugin {
public:
OneWirePlugin(byte pin);
void loop();
};
OneWirePlugin::OneWirePlugin(byte pin) {
}
void OneWirePlugin::loop() {
Serial.println("OneWirePlugin::loop()");
}
Run Code Online (Sandbox Code Playgroud)
我期待调用派生实例的loop()方法将执行OneWirePlugin::loop().
但是,这只发生在我在派生类上下文中调用它时:
Plugin p = Plugin();
Plugin o = OneWirePlugin(ONEWIRE_PIN);
OneWirePlugin q = OneWirePlugin(ONEWIRE_PIN);
p.loop(); …Run Code Online (Sandbox Code Playgroud) 我正在将数据从Arduino发送到控制台。收到数据触发事件后。但是我现在遇到此错误“无法将类型'char'隐式转换为'string'”
事实证明,noTone()和tone()在核心的arduino API中,但似乎没有为Arduino Due实现。我希望使用tone()并noTone()实现此处找到的马里奥死亡声音,但是当我添加代码并对其进行编译时,出现以下错误:
Run Code Online (Sandbox Code Playgroud)trenchRun:154: error: 'tone' was not declared in this scope trenchRun:156: error: 'noTone' was not declared in this scope
如果您有兴趣,这里有一个SSCCE,是在Mac OS X 10.8上针对Arduino 1.5.4编译的:
void setup() {
// put your setup code here, to run once:
}
void loop() {
tone(1, 12345, 1000);
}
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)sketch_oct24a.ino: In function 'void loop()': sketch_oct24a:7: error: 'tone' was not declared in this scope
由于我有Arduino Due,因此我只能使用Arduino 1.5.4。
如何实现Due 的tone()和noTone() …
我正在为一个 arduino 项目编码,我遇到了这个问题,谁能帮帮我!
if(condition1){
//my codes here
}
if(condition2){
//my codes here
}
if(condition3){
//my codes here
}
......
if(condition100){
//my codes here
}
else{
my codes here
}
Run Code Online (Sandbox Code Playgroud)
我想检查我所有的 if 条件,如果条件为真,则执行代码,并且仅当所有 if 条件都不为真时才运行 else 语句。请注意,我无法使用,else if因为我想检查所有 if 条件,如果都不为真,我想运行 else If 条件不相互依赖
我是编码的初学者,尤其是Arduino.我一直在做很多项目,但我遇到了一个问题.我似乎无法弄清楚如何进行有限循环.我正在看一个类似于while循环的东西,它在四次后停止.这里是实施的地方,让您更好地了解我在寻找什么.
#include <Servo.h>
int thumbPin = 2;
int ndxPin = 3;
int midPin = 4;
int rngPin = 5;
int pnkyPin = 6;
Servo thumb;
Servo index;
Servo middle;
Servo ring;
Servo pinky;
void setup() {
Serial.begin(9600);
thumb.attach(thumbPin);
index.attach(ndxPin);
middle.attach(midPin);
ring.attach(rngPin);
pinky.attach(pnkyPin);
}
void loop() {
/* I want this code in the comment to be ran four times, then continued on to the code after
thumb.write(0);
delay(20);
thumb.write(0);
index.write(0);
middle.write(0);
ring.write(0);
pinky.write(0);
thumb.write(150);
index.write(150);
middle.write(150);
ring.write(150);
pinky.write(150); …Run Code Online (Sandbox Code Playgroud) arduino ×13
c ×5
c++ ×3
raspberry-pi ×2
arduino-uno ×1
c# ×1
frequency ×1
i2c ×1
if-statement ×1
linux ×1
loops ×1
math ×1
physics ×1
serial-port ×1
stm32 ×1
strncmp ×1
webclient ×1