Most Popular

1500 questions
5
votes
3 answers

what is the use of "<<=" operator?

I recently read this piece of code and I dont know what is the use of "<<=" in the for loop: for (mask = 0x01; mask>0; mask <<= 1) { if (data & mask){ // choose bit This is the entire code: //Created August 23 2006 //Heather…
explorer
  • 379
  • 2
  • 5
  • 17
5
votes
2 answers

LCD scrolling down problem

I have a list of set-ups and I only have 2 rows in the lcd , I'm trying to scroll down for the moment and I'm doing this by changing the row in the setcursor function to either 0 or 1. However since that I'll be having about 10 set-ups I used an…
user730
  • 51
  • 1
  • 3
5
votes
3 answers

arduino resets or hangs after providing power to DHT22

I'm developing a low power project based on Atmega328p which among other things uses a DHT22 to measure air humidity. DHT22 spec says that it consumes 50uA when idle. This is too high for me (I'm aiming at sub 10uA consumption for the whole device…
rubix_addict
  • 225
  • 4
  • 6
5
votes
1 answer

Chain of, or one big if sentence

(This might be more of a common C question) I want to test several conditions in an IF-sentence if(variable) { // fastest check if(register) { // a bit slower if(read_peripheral) { // very slow check // [do…
5
votes
4 answers

Timer2 does not work as it should

I am currently playing with Arduino timers (on UNO currently) and I am building a library that has a function that must be called every millisecond. There is plenty of code samples on Internet so I went with something that seemed perfect for my…
jfpoilpret
  • 9,162
  • 7
  • 38
  • 54
5
votes
2 answers

Is it wise to use analog input pins to read digital buttons?

I am thinking about building a circuit that is literally going to take 11 of the 14 digital pins of an UNO to communicate with an SD card and an external EEPROM chip (EEPROM programmer). Using 4 shift registers and the SD card, I will have 1 digital…
cbmeeks
  • 247
  • 2
  • 10
5
votes
3 answers

Arduino Core for the Raspberry Pi Pico

I recently bought a Raspberry Pi Pico to play with, and am attempting to upload my first program to it the Arduino way, as my own operating system rather than a c++ program over an existing operating system (meaning to replace the built-in Raspberry…
nerdguy
  • 63
  • 6
5
votes
6 answers

Lowest power possible in Arduino

I have googled all around and I know about some tricks to make ATmega328 not being a power hog. I am using Arduino Nano V3.0. However, I didn't find out what is the minimal consumption possible with it? My project consists of an Arduino that will…
nemewsys
  • 225
  • 1
  • 5
  • 13
5
votes
5 answers

Should I try to make my sketches as small as possible, even when I have enough room?

There has been a lot of talk about shrinking sketches recently, but if you don't need the room, should it be done? Will it speed up my program? Take this code: int led = 13; int val; void setup() { pinMode(led, OUTPUT); …
Anonymous Penguin
  • 6,365
  • 10
  • 34
  • 62
5
votes
2 answers

What's taking up so much RAM in an almost empty sketch?

I wanted to check how much memory (RAM) is used by an "empty" sketch. Here is my code: int freeRam() { extern int __heap_start, *__brkval; int v; return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); } void setup() { …
rubix_addict
  • 225
  • 4
  • 6
5
votes
0 answers

SPI between Master arduino and Slave arduino

How can I send the string from Slave SPI to Master SPI? I want to write code in Bare Metal. The problem which I am facing is I can't make out what will be my blocking function in Master SPI code when receiving data from slave SPI. As my SPIF bit is…
Kunal
  • 81
  • 1
5
votes
2 answers

Why are LED 0 and 1 on as well?

I was just playing around a bit and ran into a strange problem. LED 3, 5, 6, 9 and 10 are on, as intended. For some reason LED 0 and 1 are on as well. Can someone explain why this is happening? int ledPins[] = {3, 5, 6, 9, 10}; int pinCount =…
5
votes
1 answer

How to connect 5V sensors to 3.3V digital input (Due)?

I'm completely new with Arduino and microcontrollers in general. I have several 5V sensors, and need 3.3V because that's the max for the Due. Is it possible to use a resistor to connect it to the Arduino? Do I have to measure the current from the…
Friend of Kim
  • 1,533
  • 3
  • 16
  • 16
5
votes
2 answers

What’s the most common (and low cost) microprocessor with at least two threads?

I want to make a next version of my current project. I’m hoping to use an Arduino compatible processor that also supports at least 2 processes simultaneously without using pro threading or any other software workaround. The more commonly used the…
5
votes
3 answers

Can I use an ATmega328 alone without anything and what is the max voltage I can power the atmega328 with

Okay 2 questions. If I am to replace the Arduino with an ATmega328 programmed with a standard blink on pin 13, is this configuration correct, do I still need oscillators and whatnot? Second question is, what is the max voltage I can power the…
suckms
  • 125
  • 1
  • 1
  • 7