- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们有一个原型(prototype),可以将大钞票变成小钞票。我们使用的是带有键盘的arduino微 Controller ,用户应该按下键盘上的“0”按钮以便机器开始交易。用户可以输入一个值来选择其面额类型。例如,如果您将一张 100 美元的钞票插入机器中,用户可以选择是否要将其作为两张 50 美元的钞票或五张 20 美元的钞票。
我们原型(prototype)的问题是,当机器检测到一笔交易没有钱了时,用户仍然可以使用机器进行另一笔交易。如果您随机按下所有键,我们的编码中存在一个“错误”。用户可以按“0”开始交易。如果机器检测到没有剩余资金可用于另一笔交易,我们希望禁用键盘。
以下是机器检测到没有账单时的代码。如果没有账单,它还会通知业主。
void SupChkU(){
sLBill5H = digitalRead(LBill5H);
if (sLBill5H == HIGH){
lcd.setCursor(0, 0);
lcd.print("Low in resources");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
delay(100);
Serial.println("500 Bills is empty ");
if (SLvlBill5H == false){
SLvlBill5H = true;
textForSMS = "500 Bills is empty, please refill ";
sendSMS(textForSMS);
}
readkeyboard();
if (keypressed == 11){
RefillS();
}
}
sLBill1H = digitalRead(LBill1H);
if (sLBill1H == HIGH){
lcd.setCursor(0, 0);
lcd.print("Low in resources");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
delay(100);
Serial.println("100 Bills is empty ");
if (SLvlBill1H == false){
SLvlBill1H = true;
textForSMS = "100 Bills is empty, please refill ";
sendSMS(textForSMS);
}
readkeyboard();
if (keypressed == 11){
RefillS();
}
}
sLBill50 = digitalRead(LBill50);
if (sLBill50 == HIGH){
lcd.setCursor(0, 0);
lcd.print("Low in resources");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
delay(100);
Serial.println("50 Bills is empty ");
if (SLvlBill50 == false){
SLvlBill50 = true;
textForSMS = "50 Bills is empty, please refill ";
sendSMS(textForSMS);
}
readkeyboard();
if (keypressed == 11){
RefillS();
}
}
if (CntB5H < 10){
lcd.setCursor(0, 0);
lcd.print("Low in resources");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
delay(100);
Serial.println("PhP 500 Bills Low Level");
if (SLvlBill5H == false){
SLvlBill5H = true;
textForSMS = " Low Level on PhP 500 Bills, please refill ";
sendSMS(textForSMS);
}
readkeyboard();
if (keypressed == 11){
RefillS();
}
}
if (CntB1H < 10){
lcd.setCursor(0, 0);
lcd.print("Low in resources");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
delay(100);
Serial.println("PhP 100 Bills Low Level");
if (SLvlBill1H == false){
SLvlBill1H = true;
textForSMS = " Low Level on PhP 100 Bills, please refill ";
sendSMS(textForSMS);
}
readkeyboard();
if (keypressed == 11){
RefillS();
}
}
if (CntB50 < 10){
lcd.setCursor(0, 0);
lcd.print("Low in resources");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
delay(100);
Serial.println("PhP 50 Bills Low Level");
if (SLvlBill50 == false){
SLvlBill50 = true;
textForSMS = " Low Level on PhP 50 Bills, please refill ";
sendSMS(textForSMS);
}
readkeyboard();
if (keypressed == 11){
RefillS();
}
}
sLCoin1 = digitalRead(LCoin1);
if (sLCoin1 == HIGH){
LvlC1 = true;
lcd.setCursor(0, 0);
lcd.print("Low for 1 Peso ");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
Serial.println(" Low Level for 1 Peso Bin ");
delay(1000);
if (SLvlC1 == false){
SLvlC1 = true;
textForSMS = " Low Level for 1 Peso Bin ";
sendSMS(textForSMS);
}
}
if (sLCoin1 == LOW){
SLvlC1 = false;
}
sLCoin5 = digitalRead(LCoin5);
if (sLCoin5 == HIGH){
LvlC5 = true;
lcd.setCursor(0, 0);
lcd.print("Low for 5 Peso ");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
Serial.println(" Low Level for 5 Peso Bin ");
delay(1000);
if (SLvlC5 == false){
SLvlC5 = true;
textForSMS = " Low Level for 5 Peso Bin ";
sendSMS(textForSMS);
}
}
if (sLCoin5 == LOW){
SLvlC5 = false;
}
sLCoin10 = digitalRead(LCoin10);
if (sLCoin10 == HIGH){
LvlC10 = true;
lcd.setCursor(0, 0);
lcd.print("Low for 10 Peso ");
lcd.setCursor(0, 1);
lcd.print("Please see owner");
Serial.println(" Low Level for 10 Peso Bin ");
delay(1000);
if (SLvlC10 == false){
SLvlC10 = true;
textForSMS = " Low Level for 10 Peso Bin ";
sendSMS(textForSMS);
}
}
if (sLCoin10 == LOW){
SLvlC10 = false;
}
}
最佳答案
如果键盘连接在 SPI(MISO、MOSI、SCK,...)( https://de.wikipedia.org/wiki/Serial_Peripheral_Interface )上,您可以通过禁用接口(interface)来禁用它:
1) 将 PRR(节能寄存器)中的 PRSPI (?) 位设置为“1”
2) 取消设置(设置“0”)SPCR 寄存器(?)(SPI 控制寄存器)中的 SPE 位(SPI 启用)
请参阅处理器的数据表,也许寄存器和位命名有所不同
如果键盘连接在 UART 上,同样的方法(禁用接口(interface))也适用,...
关于c - 使用 C 编程禁用 arduino 微 Controller 上的键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35815024/
我尝试使用键盘和 TVout 库制作一个简单的 arduino 计算机。 由于库不兼容,我想使用 arduino mega 作为主板,使用 arduino uno 作为图形芯片。 但它总是在电视上只显
我正在尝试学习如何评估一个值是增加还是减少。在这种情况下,我使用从 0 - 14 映射的电位计。基本上我需要它来查看当前值,如果当前值增加,则打印一件事,如果该值减小,则打印其他内容。 到目前为止,这
我曾尝试使用 Arduino IDE 中提供的标准草图测量模拟引脚值。然而,即使没有连接到引脚,它也会打印出随机值。有什么需要注意的吗? 我有一个从 5V+ 连接到模拟引脚 0 的 FSR 传感器 最
我正在尝试在字符串旁边打印一个整数,但它并没有真正起作用并且我感到困惑。 int cmdSeries = 3; Serial.println("Series : " + cmdSeries);// T
我有一个使用不同电源供电的设备,我正在尝试与其串行通信,它有 TX 和 RX 线、GND 和 2.7+ 线,它非常笨拙,所以它有自己的 PS。 目前我得到了一些奇怪的结果,所以想知道是否需要在 Ard
使用Arduino Blackwidow或Yellowjacket有运气吗?在评论方面,我找不到关于它们的在线信息。 我想连接到无线路由器,发送与已读取的电阻有关的小型POST请求,并以JSON格式接
我的 Arduino Uno 已全部设置完毕并且运行良好。 项目:Arduino 根据给定的命令控制 9v 电机。由于 Arduino 仅提供 5v,我通过晶体管为其添加了 9v 电池 我决定将新代码
我最近买了一个Arduino Uno ,现在我正在尝试一下。我有几个 18B20 传感器和一个连接到它的 ENC28J60 网络模块,然后我正在制作一个草图,以便我可以从浏览器连接到它,并以简单的网页
我有一个使用不同电源供电的设备,我正在尝试与其串行通信,它有 TX 和 RX 线、GND 和 2.7+ 线,它非常笨拙,所以它有自己的 PS。 目前我得到了一些奇怪的结果,所以想知道是否需要在 Ard
已结束。 这个问题是 off-topic .它目前不接受答案。 想要改进这个问题? Update the question所以它是on-topic堆栈溢出。 关闭 9 年前。 Improve this
我有一个 Arduino 入门套件,它带有主动和被动蜂鸣器。不幸的是,我似乎不知道哪个是哪个。我只知道一个比另一个长一点,我可以看到下面的绿色电路板。 最佳答案 有源蜂鸣器会自行发出声音。你基本上只是
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
我想从 Arduino 中的几个传感器获取一些数据,然后创建一些端点,以便我可以从 Web 应用程序中的传感器获取数据。那可能吗? 最佳答案 您可以使用 Firebase 或 Thingspeak 服
我正在创建一个新库来一起控制键盘和 LCD。大多数代码似乎都可以编译,但是当它到达我定义 LiquidCristal 变量的行时,它说: 'LiquidCrystal' does not name a
我从最近刚开始使用arduino的我的一个学生那里得到了一些代码。 他试图做一个中断,并且有点奏效。问题是它运行了两次(他调用了该函数),所以 bool 值被重置了。 我试图找到答案,但找不到任何答案
我最近开始了 Arduino 开发,在向 friend 和同事解释时,我收到的一个问题我没有答案,也想知道为什么微 Controller 运行的程序称为草图?这是从电气工程继承下来的惯例吗?我不熟悉这
如何在编译时确定 Arduino 的板类型(例如 Uno vs Nano)? 不要与确定处理器类型混淆。正如我所看到的那样,例如#如果定义(__AVR_ATmega32U4__)... 同样,我想要一
我已经看了很多,但还没有找到涵盖所有这些的好教程。因此,我需要将项目分成多个选项卡/ino 文件,只是为了使其更清晰。 所以当你打开一个新标签后,我想问几个问题: 如果主项目文件(例如 main)还有
您好,我正在使用 https://github.com/pubnub/arduino 中的 PubNubsubscriber 示例我能够接收消息,只要我收到消息,一切都运行正常,如果一段时间过去了,比
所以我的 arduino 正在从串行接收一个字符串,由三个用逗号分隔的值组成,我试图将这些值分成三个不同的变量,其余的我可以做。 字符串看起来像这样“1000,1.5,0.9”或“5000,20,0.
我是一名优秀的程序员,十分优秀!