New answers tagged

1

The SmartInventor library is to be used with the Rokit Smart board. That board is based around the ATMega32. The Arduino Mega is not a Rokit Smart board, so the library will not work, since the Arduino Mega us based around the ATMega2560. The two chips are different, and have different sets of internal peripherals. So the registers have different names ...


0

This will fix the problem: void loop() { if(Serial.available()) { String s=(char*)Serial.read(); } } This is because in C: Strings are defined as an array of characters. You cannot assign a primitive to an array... I guess the casting into pointer can be implicit as in your second example..


1

You misunderstand Serial.read(): it does not return a String or sth. like a char array, but an integer, representing only the last byte in the input buffer that hasn't been read. What you probably want to do is to interpret those incoming bytes as chars and accumulate those in a String. E.g. like this: String s=""; while(Serial.available()) { // as long ...


1

this isn't an arduino specific error what you're trying to do is declare and initialize the variable in one statement which is causing the problem. As you've figured it out already. Declaring the variable first String s; and initializing it another statement does the job for you s=blabla Hope this helps. PS, try posting the error that you get during ...


0

I don't have much experience with Arduino's String type, however, most people (including myself) don't advise to use it. Because the Arduino only has 1 KB of SRAM and the String type has its own hidden memory allocation, you might run out of memory without you know it, resulting in crashing/frozen programs without a clue what is happening. Instead use ...


1

You have probably installed the box servo backwards so that when it tries to open it actually closes and vice versa.


0

I found out that by adding this while loop to an IRremote use, the code after it won't run until the button is released. while(irrecv.decode(&results)){ irrecv.resume(); delay(150); } This will keep the buttons pressed if the code at the end on loop() ends the input.


0

firstly, move your pinMode() settings to setup section. in your code, when the temperature is 21 active pin will be 6 and 8. you should rewrite your code in next ways: 1: if (t < 22) { ... its cold temp ... } else if (t > 26) { ... its hot temp ... } else { ... it's nor temp ... } 2: if (t < 22) { ... its cold temp ... } if (t > 26) ...


1

For PIC32 you need chipKIT. Not all chips are supported, but most of the PIC32MX and PIC32MZ chips are. Which exact PIC32 chip(s) do you have? You will need to install a bootloader, for which you will need a programmer. It is possible to build a programmer using an Arduino, though TBH I'd just pick up a cheap PICkit2 clone from China. As for the 8-bit ...


0

It seems, that you are talking about 2 different things: The programming/burning of the PIC can be done via an Arduino (so you don't need to build a complex PIC programmer circuit). It is irrelevant, what microcontroller type is on the programmer, as long as the programmer speaks ISP (the programming protocol). So even, when your specific PIC is not ...


1

You code shows multiple errors: At the start you are commenting the SmartInventor library out. You need this library. You should delete the comment markers /* and */ around the #include statement. At the end of the code you have < SmartInventor.h / >. You should delete this line. It is simply wrong, not even C/C++ syntax. You seem to misunderstand, ...


1

I have a post about this problem. Basically you cannot attach a class function with attachInterrupt because of the hidden "this" pointer which needs to be supplied to a (non-static) class function, where "this" is the particular instance of the class. You can work around it like this: class myClass { static volatile bool switchChanged; // declare ...


0

You cannot do what you are trying to do. There is no direct correspondence between some number of bits and a decimal digit. With hexadecimal, every 4 bits corresponds to exactly 1 hex digit. That is why hex is used for computers. One hex digit represents exactly 4 bits. Every time you add another hex digit, you add 4 bits. Two hex digits corresponds to ...


0

Having a line from Arduino 1 to Arduino 2 to indicate that Arduino 2 should do something is sufficient. Simple way: a line that is an input on both sides with internal pullups turned on. Both sides monitor it. When Arduino 1 wants to write, it checks to make sure the line is high, then it makes its pin an output and pulls it low, and when done releases ...


0

Test on my Arduino Uno, your code works fine with a simple copy-paste. Remember to set the proper baud rate.


2

I met the same problem and based on the previous answers I wrote this script for Arduino IDE. I'm using it successfully on different OSs for many months to now. In the repository, you can find the instructions to install it.


1

Assuming you have an RFID scanner that you can interface with the Arduino, sure. The Arduino is a modest 8-bit processor running at 8 or 16 mHz, with pretty limited memory. You program it in C/C++. What you describe is dirt-simple, and well within the abilities of an Arduino, so yes.


Top 50 recent answers are included