arduino

g++ compiler flag to minimize binary size

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 10:56:10
问题 I'm have an Arduino Uno R3. I'm making logical objects for each of my sensors using C++. The Arduino has very limited on-board memory 32KB*, and, on average, my compiled objects are coming out around 6KB*. I am already using the smallest possible data types required, in an attempt to minimize my memory footprint. Is there a compiler flag to minimize the size of the binary, or do I need to use shorter variable and function names, less functions, etc. to minimize my code base? Also, any other

How do I get the NVIDIA core temperature in an integer value?

别说谁变了你拦得住时间么 提交于 2019-12-18 09:38:09
问题 I am taking a Arduino microcontroller class and I'm working on my final project: an automated computer cooling system that works according to case temperature. I was unable to get my NVIDIA GPU core temp using the following sources: this MSDN link or this NVIDIA link. How can I get the value of the temperature of my GPU? My knowledge in C# is basic and i couldn't make heads from tails on that manual or code examples in MSDN. 回答1: I'm gonna go ahead and answer my own question after a long time

Maintaining communication between Arduino and Java program

不羁岁月 提交于 2019-12-18 05:12:29
问题 I have gotten a project in school that consists of a RC car that gets controlled over WiFi. It works just fine for a few seconds, but then it just stops the connection and tries to reconnect again. Thing is that if i'm making a car that relies on that unstable connection, it can cause accidents. Either to itself or a person. Perhaps i'm doing something wrong? My question is, how do i keep that connection active at all times? Here is my program so far: Arduino Client: #include <SPI.h> #include

Pyserial problem with Arduino - works with the Python shell but not in a program

只愿长相守 提交于 2019-12-18 04:49:07
问题 All right, so I am positive my Arduino circuit is correct and the code for it. I know this because when I use the serial monitor built into the Arduino IDE and send 'H' an LED lights up, when I send 'L' that LED turns off. Now I made a Python program import serial ser = serial.Serial("COM4",9600) ser.write("H") When I run the code the LED blinks on for a second then goes back off. However when I do each of these lines separately in the shell it works just like it is supposed to. Any ideas?

How to combine C++ strings and Arduino Strings?

佐手、 提交于 2019-12-18 04:38:21
问题 I have been writing a library for my project (for now I am using Arduino). The problem that I have is that string in C++ and in Arduino differ. That is, I would like my library to be independent of Arduino, so I am using #include <string> and later declaring string s; . However in Arduino strings are defined by Arduino and declared String s2 . When I include my library to the sketch I get error: string: No such file or directory on the line where I try to include C++ string library ( #include

Is it possible to include a library from another library using the Arduino IDE?

依然范特西╮ 提交于 2019-12-18 04:33:59
问题 I'm trying to write an Arduino library (effectively a C++ class) which itself references another library I have installed in my Mac's ~/Documents/Arduino/libraries directory. At the top of the .cpp of the library I'm writing, I've tried #include <ReferencedLibrary.h> and #include "ReferencedLibrary.h" ... neither of which work. I can successfully #include <ReferencedLibrary.h> from sketches in my ~/Documents/Arduino directory. Am I missing something or is this a limitation of the Arduino IDE

Eclipse C/C++ Shows Errors but Compiles?

风流意气都作罢 提交于 2019-12-18 03:04:34
问题 So I am building some Arduino code in eclipse, as described in Your Second Arduino Project, but every time I use an Arduino library, such as Serial , Eclipse underlines my function names, claiming they cannot be resolved. However, the code actually compiles, so I'm kind of at a loss as to why Eclipse thinks the functions are missing. If anyone has any idea on how to solve this problem it would be appreciated. Thanks beforehand. EDIT: I should have been more specific, Eclipse underlines the

Control an Arduino with Java

社会主义新天地 提交于 2019-12-17 22:19:40
问题 I am looking to turn an LED on and off with a Java program. I did the project in C# in roughly 5 minutes, but it seems to be somewhat more challenging in Java. I had the Arduino wait for a 1 or 0 to be written to the COM port and would change the LED based on that. The code I am using for the Arduino is as follows. 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' ) {

How to “reset” an Arduino board?

只愿长相守 提交于 2019-12-17 21:53:54
问题 I've uploaded a sketch to an Arduino Uno whose loop is something like this: void loop(){ Serial.println("Hello World"); } So, now, I can't upload anything anymore, because the IDE says "port already in use". Is there a way to "reset" the Arduino without another programmer? EDIT : Nothing else is using the serial port, and everything went just fine until I uploaded the previous sketch. EDIT : I've found some interesting things: Problems with 0021 on Ubuntu 10.04 Lucid Lynx Re: Problems with

How to unpair or delete paired bluetooth device programmatically on android?

旧街凉风 提交于 2019-12-17 17:26:49
问题 The project is to use my android phone to connect with my arduino devices. but how can I unpair the paired ones. I see it seems the paired list is stored where bluetoothadapter could retrieve anytime. PS: 1st, I know long press paired device will unpair it. but the question here is how can I make this happen programmatically? 2nd, I have checked bluetoothdevice and bluetoothAdapter class, there is no function to implement this. thanks. 回答1: This code works for me. private void pairDevice