text:
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 = sizeof(ledPins);

void setup(){
  for (int i = 0; i < pinCount; i++){
    pinMode(ledPins[i], OUTPUT);
  }
}

void loop(){
   for (int i = 0; i < pinCount; i++){
     digitalWrite(ledPins[i], 1);
   }
}

What kind of Arduino are you using? Uno?

Yes, it is an Arduino Uno.

Can you show the wiring?

Sorry, that would be quite difficult at this very moment. Though, I tested with some different code, like very specific numbers, such as
digitalWrite(5, 1);

for example, then it only turns LED 5 on, and none of the others. It must be code related, I guess.

The behaviour of your program is undefined because you're reading past the end of your array.
In C/C++, the sizeof operator always gives you the size of something in bytes. It doesn't directly tell you the number of items in an array. Since int is usually 2 bytes for Arduino programming, the pinCount variable is actually being initialised to 10 (5 items x 2 bytes each).
The result is that each for loop is actually doing 10 iterations. The first 5 iterations are OK, reading correctly from the ledPins array. However, the rest of the iterations are reading whatever data happens to be in memory after that. This means it could be trying to initialise and switch on any pin, potentially including 0 and 1.
I can't guarantee that this is the source of the problem, but it's certainly very important to fix.
The solution is quite easy though. Divide the total size of the array by the size of a single element:
int pinCount = sizeof(ledPins) / sizeof(int);

Thanks for the help! That's some very important information right there. It doesn't completely solve the problem, but that's okay. I'm getting closer and learning more, that's what counts!

Actually with the 2 answers combined, the problem is pretty much gone. Thanks for the help everyone. I just had to initialize 0 and 1 as well, other than that it's fixed with this answer!

Alternatively use byte instead of int. So byte ledPins[] = {3, 5, 6, 9, 10};

Sweet! Thanks for the help, I will remember this!

Better, define a macro to do the calculation, e.g. #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) and then use int pinCount = ARRAY_SIZE(ledPins); or just skip the pinPount variable all together and use the macro directly. See also this answer.

You haven't initialised the other pins at all; or included your circuit, but clearly you have LEDs on more pins than those defined (5 defined, 7 on).
The other LEDs are, therefore, in an undefined state - and may well be attached to pins set 'on' by default in your circuit. You probably need to either move 0/1 off the serial interface or explicitly set them 'off'.

That's very true, I thought I had to initialize them for them to become active in the first place. I do indeed have more than 5 LEDs on the breadboard, but was only going to use 5 of them.


text:
Sniffing RF signals
I am using an Arduino UNO and an RXb6 (I would link to the data sheet if I could find one) to try to decode a RF Signal that controls a remote outlet. I have the devices connected as you would assume 5V+ to 5v, Gnd to Gnd, Antenna is not connected as I think it would only exacerbate my problem, and data is connected to the A0 pin on my UNO.
The problem I am having is with all the noise that I am getting with my signal.I hooked it up to my o-scope to give a better idea of whats happening. When no signal is being transmitted this is the noise I am seeing:

Just lots of static. When I press the remote button I can see a clean signal come through (note that it is cutoff):
I was able to export a CSV of the wave and manually clean it up but it was just such a pain trying to translate it back to highs and lows for the arduino to send.
How can I reduce signal noise on my 433MHz receiver so the arduino can read the actual signal instead of noise?

Put both the transmitter and the receiver in a microwave (or another Faraday cage). Try having the usb lead, that's sticking out, be as short as possible.

Unless you are trying to build something that automatically learns, it will probably be easier to do your analysis with an RTL-SDR dongle, and encode the cleanup up result in an Arduino sketch.

I'm adding another answer, because I don't think the core thing to grasp is mentioned, and others might benefit :)
The noise you are seeing, is actually the result of a feature of the RXB6, KSA6, and similar modules. When they see no signal, they increase gain/sensitivity until they do see a signal. The upside of this is they are very sensitive, and can operate well over quite long ranges. The downside is that if there really is no signal, they will start picking up anything that remotely looks like a signal, the noise you see :)
Dealing with this noise is the job of the software/protocol and other electronics built around the receiver.
A common way to solve it, which the VirtualWire library also uses, is to send some unimportant 'data' first, which makes the receiver decrease it's sensitivity, and then send the  important data.
Another common way is to just repeat the data several times, this is also what your wall sockets most likely do.
In software you can usually find the 'important' parts by looking at pulse lengths, the noise is usually short high pulses, most protocols use far longer pulses, which also have a predictable/defined length.
What I did in exactly your case was to dump the sound recording as a raw signed pcm 16 bit file, which I could then easily read into a bit of software I wrote, which find's the high/low transitions, filters out any short pulses, and then writes out the output (like a csv) you want :)

Dealing with this using audio tools isn't a bad idea.  Readers should not however that the date will be 1-bit samples - it can be expanded to 8 or 16 bit format for compatibility with audio tools, but the raw data from the radio will have only 1 bit.

That is certainly correct :) Nowadays I would use sigrok with a 3$ 'logic analyzer' board :)

noise may be suppressed by squelching the output using a comparator on an AGC threshold level.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
My Arduino Robot doesn't move, and it's the only thing that doesn't work
It will be simple. I started to look at the sketch of the Arduino Robot and just tried one, Disco_Bot, and uploaded it one the top board. The Arduino started to play some music and the name was on de LCD screen but he wasn't moving. Then i tried then sketch Wheel_Calibration. The information was on the screen but the Robot was supposed to move so that i could calibrate the speed. I was lost so I went on the Arduino page for the Arduino Robot (http://arduino.cc/en/Guide/Robot) and found nothing that could explain my problem . So now I ask you, can you please help me because iI have no idea on what i should do.
Chris

Doesn't it require batteries for the motors? I tried looking at the schematic, but couldn't find the motor driver, so that was of no use.

Did you unplug the USB cables from the robot? The robot will never move if connected to some external device; this is a protection measure.

Did it work before (motors board) or it never worked since you have it? Is it possible you unintentionally uploaded something on the motor board and overwrote the sketch there (which you are not supposed to do except if you really know what you do)?

@Greben, well normally it comes whit a set of 4 pills but i noticed that the motor doesn't use the batteries and i have power it by a other source. Thank you for you're help !

@jfpoilpret, in the back i got i sed that it was all tested before shipping, but is thing i also did plug the usb cable on the motor board and may have overwrote the sketch that was preloaded. I'll try to find them to reste the board. Thank you for you're help !

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Arduino Program for Olimex ekg/emg shield to detect heart rate in bpm as well as show ECG in ElecGuru software
The manual of olimex ekg/emg shield provides a link for ShieldEkgEmgDemo code, it can show ecg in realtime in a software ElecGuru. The link to software is also provided in the manual. I need to get the numerical value of heart rate in bpm as well as the ecg. I want to implement this in a larger program where I can use something like this.
if(heartRate > 90){
        //do something
}

I have an Arduino UNO board and an Olimex ekg/emg shield with electrodes. I tested the shield with demo code and it worked fine. I got a clean ECG on ElecGuru.

You seem to know what you task entails pretty clearly, but what is your question? is there a portion of the demo code you don't understand?


text:
Installing Optiboot loader for pro mini 3.3V 8MHz
I have tried to install a better bootloader in some chinese Arduino pro mini boards. I have tried the OptiLoader application via an ArduinoAsISP. I failed in some way. The boards got unstable, I can not repeat boot installation, I can not upload any application. They both time out.
This is the result from Atmega_Board_Detector most of the time.
Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Feb 24 2018 at 10:27:05 with Arduino IDE 10805.
Attempting to enter ICSP programming mode ......................................
................
Failed to enter programming mode. Double-check wiring!
Programming mode off.

Below is the result from Atmega_Board_Detector after many tries when it suddenly gave one answer. Nothing is changed in hardware or software between the test above and this test.
Question: Anything in this dump that says what I did wrong?
Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Feb 24 2018 at 10:27:05 with Arduino IDE 10805.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xE2
HFuse = 0xDA
EFuse = 0xFD
Lock byte = 0xFF
Clock calibration = 0x48
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 2048 bytes starting at 7800

Bootloader:

7800: 0x0C 0x94 0x34 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7810: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7820: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7830: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7840: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7850: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7860: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x11 0x24 0x1F 0xBE 0xCF 0xEF 0xD8 0xE0
7870: 0xDE 0xBF 0xCD 0xBF 0x11 0xE0 0xA0 0xE0 0xB1 0xE0 0xEA 0xE8 0xFF 0xE7 0x02 0xC0
7880: 0x05 0x90 0x0D 0x92 0xA2 0x30 0xB1 0x07 0xD9 0xF7 0x12 0xE0 0xA2 0xE0 0xB1 0xE0
7890: 0x01 0xC0 0x1D 0x92 0xAD 0x30 0xB1 0x07 0xE1 0xF7 0x0E 0x94 0x2D 0x3D 0x0C 0x94
78A0: 0xC3 0x3F 0x0C 0x94 0x00 0x3C 0x98 0x2F 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95
78B0: 0x90 0x5D 0x8F 0x70 0x8A 0x30 0x7C 0xF0 0x28 0x2F 0x29 0x5A 0x80 0x91 0xC0 0x00
78C0: 0x85 0xFF 0xFC 0xCF 0x90 0x93 0xC6 0x00 0x80 0x91 0xC0 0x00 0x85 0xFF 0xFC 0xCF
78D0: 0x20 0x93 0xC6 0x00 0x08 0x95 0x28 0x2F 0x20 0x5D 0xF0 0xCF 0x98 0x2F 0x80 0x91
78E0: 0xC0 0x00 0x85 0xFF 0xFC 0xCF 0x90 0x93 0xC6 0x00 0x08 0x95 0xEF 0x92 0xFF 0x92
78F0: 0x0F 0x93 0x1F 0x93 0xEE 0x24 0xFF 0x24 0x87 0x01 0x80 0x91 0xC0 0x00 0x87 0xFD
7900: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
7910: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0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FF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
90: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
A0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
B0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
C0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
D0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
E0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
F0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF

Programming mode off.

what is the part number of the controller chip?

On the target Pro Mini is an ATMEL MEGA328P AU, On the Arduino as ISP is a MEGA328P-PU


text:
Sweep with two shift registers
I am working with 8 dual color LED's and 2 shift registers. My connections are in place. But I do not understand how to work with 2 shift registers.
So I am trying to make this: turn the first led on, turn the first led of, go to the next led, turn it on, turn in off, etc...
I do not know how to jump from the first shift register to the second shift register when the last LED of the first shift register is turned off.

Exactly the same as when you're trying to keep them dark when lighting an LED with the first register: shift two bytes.
The first byte shifts into the first register to begin with, and then out of the first register and into the second register when you shift the second byte into the first register. Just make sure only the appropriate bits are set in both bytes and you're good to go.


text:
Going from one shift register to two shift registers
I am able to control one shift register with this shift function:
void shift (int pin) {
  shiftOut(ds,shcp,MSBFIRST,pin);
  digitalWrite(stcp,HIGH);
  delay(100);
  digitalWrite(stcp,LOW);
}

but when I move to 2 shift registers it does not add up.. how do I need to adapt this method to make it work with 2 shift registers when I am going from 8 leds to 16 leds?
My second register now just copies the first register.. I want the second register to continue instead of repeat

It sounds like the primary issue is how you've connected the two shift registers.  You just need the bit shifting out of the first one to shift into the second one so they act, together, as one longer shift register.

The example pictured is described in full here, under the heading "Example 2":
http://arduino.cc/en/tutorial/ShiftOut
As Klaus mentioned, you want to first ShiftOut the byte you intend to wind up in the second resister, then ShiftOut the byte for the first register.  This will push your first byte through to the second register.

split the data into 2 bytes, and then send those, one after the other
void shift (int pin) {
  byte data1 = 0;//shift register 1
  byte data2 = 0;//shift register 2
  if( pin<8 )
    data1 = (1<<pin);
  else
    data2 = (1<<(pin-8));
  shiftOut(ds,shcp,MSBFIRST,data2);//note that you send the data for shift register 2 first
  shiftOut(ds,shcp,MSBFIRST,data1);
  digitalWrite(stcp,HIGH);
  delay(100);//why wait this long?
  digitalWrite(stcp,LOW);
}

I think the OP's pin parameter was actually the raw binary pattern being sent to the shift register (rather than the number of the pin to be brought high).

In that case you'd use, byte data1=lowByte(pin) byte data2=highByte(pin).

void shift(int pin) {
  digitalWrite(stcp, LOW);

  // shift the bits out:
  shiftOut(ds, shcp, MSBFIRST, pin >> 8);
  shiftOut(ds, shcp, MSBFIRST, pin);
  // turn on the output so the LEDs can light up:
  digitalWrite(stcp, HIGH);

  delay(100);
}

Configure SPI
Hook up your shift registers

common SS
common CLK
QH* of the first shift register to SER of the next

In order to transfer the bytes

Pull SS low
ShiftOut first byte
ShiftOut next byte
Pull SS high again to finish the SPI transfer

UPDATE
This is untested, just out of memory!
#include<SPI.h>
// note that the pins for CLK and MOSI are defined here

unsigned int ledPattern = 0b1111000011110000;
// store the state for 16 LEDs here

void setup(void)
{
    pinMode(SS, OUTPUT);
    digitalWrite(SS, HIGH);
    SPI.setDataMode(3);
    SPI.setClockDivider(4);
    SPI.setBitOrder(MSBFIRST);

    // let's transfer 2 bytes
    digitalWrite(SS, LOW);
    SPI.transfer(ledPattern & 0xff00;) // high byte
    SPI.transfer(ledPattern & 0x00ff;) // low byte
    digitalWrite(SS, HIGH);
}

UPDATE II
You are by no means limited to 2 shift registers! In 2013, we did a 8x11 LED display for an upcycling art project. Eleven 74HC595 were chained to display some patterns. Each 'pixel' consisted of 3 12V SMD LEDs on a stripe. Consequently, each shift register was connected to an ULN2803.
I just uploaded a video from the construction phase, showing a test pattern.

could you give me an example how to transfer bytes?

@letsjak Done, but Gerben was faster :D


text:
Creating arduino library linking question
I know how to create my own arduino library and use it. I am using Xcode to create a c++ project. I have the arduino library files(Servo, Wire, Keypad, etc). If I want to include the Servo.h library file in my created library, how do I go about linking that? For some reason, I can't just add the Servo.h/.cpp files in my project because then I get other linking file problems that Servo.h references and are not linked in my project. Has anyone done this before?

I can't speak for Xcode, but in general with Arduino IDEs (UECIDE excepting) if you use a library within another library, that library also has to be #included in the main sketch.  That is the only way most IDEs determine which libraries need to be compiled into the finished program.
That's one of the first targets I had for UECIDE - to enable fully recursive library compilation.  Any libraries found within the master header of a library will also be included for compilation - and any found in those libraries, etc.  It took a lot of work (and it's by no means 100% perfect), which is why so few others do it and leave it up to the programmer to ensure the inclusion of the right sub-libraries in their sketch.

Yea, I guess I was just asking in general not necessarily with Xcode. If I were using Visual Studios, is there anyway I can use the current arduino library files (h/cpp) in my own library I am creating to be able to compile it before using? If I add, for example, Servo.h to my library it does not compile as there are other files Servo.h links to that I do not. Just seeing if there is an easy way to add other library files to my project to be able to compile.

No, it takes an intelligent IDE that properly understands the concept of the Arduino library to do that.  If the libraries were all pre-compiled code as .a files you'd still need to manually add all the -l... flags to the linker command, so it's not something that's unique to the Arduinosphere.  We just have a different way of telling the IDE what libraries need including (#include) than "normal" systems (which would equate to -lservo -lkeyboard etc)

Believe I have accomplished what I wanted to do. Using the VS Visual Micro plugin.


text:
Use Arduino pro micro to program pro mini?
So I got a pro micro and 2 pro minis and I was wondering if I could use the pro micro to program my minis? Anyone has any links or guides on how to do this, if at all possible?

Other than the normal ArduinoISP guides?

I don't know if it will still work but I will suggest you this.
As arduino micro is Leonardo compatible and you r two arduino minis are based on atmega328. You should be able to use the tutorial posted above to use micro as programmer for the two mini.
Hope that helped.


text:
Use same ground with 2 wires?
So I have 3 ground pins, but I need 4 motors on my Arduino. Can I connect multiple motors to the same ground pin?

Arduino cannot power a motor directly

You can do it as long as the current isn't excessive. I don't think there are any specs available, but the connector and the width / thickness of the copper tracks on the PCB will be the limiting factor.

All ground is internal connected.
But anyway, you CANNOT use the Arduino's power to power a motor, you will need an external power source.And again, you will connect the external power source's ground to the Arduino's ground.

If you power a motor directly from an Arduino, the Arduino's microprocessor (e.g. AtMega328P) will get fried.

And while using the motors, make sure that  the motor does not touch the Arduino board

How do I control the motor then? I need to control the speed of the motor. How would I do this?

link for more info on how to do that.

If you are having problem in coding, comment here and I will give you some sample codes.

You can connect multiple components to a single ground pin.  IF you are using a breadboard, be sure to put the wire going to the go


text:
How to add the Wiring S board to Arduino IDE v.1.6.2?
My Arduino Uno is running out of memory to support my script (yes, I've tried several ways of optimize it already: PROGMEM, EEPROM, no Strings, and so on), so I would like to upload my script to my Wiring S board.
However, instead of "porting" all libraries to Wiring, I would like to compile my script in Arduino IDE and upload it to my Wiring S. It used to be "easy" in Arduino v.1.0.x. because somwhere I got a Wiring folder (containing, among other things, a boards.txt file) and copied it to Arduino's hardware folder getting the Wiring S board listed in Arduino IDE.
Since Arduino 1.5 the specification for adding other boards changed. I'd say it's more complex now. I simply cannot understand most of the new specification (yes, I'm new into electronics), so I haven't been able to add my Wiring S board.
Running my script in Arduino 1.0.x doesn't seem to be an option, since it throws lots of errors (although the script compiles in Arduino 1.6.2).
Do you have any experience adding other boards (like Wiring S) to Arduino IDE? Could you please give me some hint?

Which version? There seem to be 4 different chips on these boards. What is the main chip? PS new specification isn't that different. It requires everything to be put in an folder (avr), and requires a platform.txt file with just a name and version (two lines). The boards.txt file has some variables with new names. You'll get some error messages in the IDE is something is incorrect.

You're right, but those changes are enough for us basic users to be unable to work with the configuration we used to work with. On the other hand, it's Wiring S v.1.0, it looks exactly like this one: http://www.lextronic.fr/P22978-platine-de-developpement-wiring-s.html

The one you link to is a Atmega644P, while v1.0 is atmega128. What boards.txt file did you use for the Arduino 1.0? So I can try to port it for you.

I use Wiring S, that works with AtMega644p. The confusion arose because on top of the microcontroller, there is a sticker saying "WIRING S 1.0" (as shown in the link I posted). So, Wiring S, AtMega644p. The boards.txt I used is https://titanpad.com/wiringsboards Thanks!

Here is my attempt at porting. I don't have that board, so I can't really test it. Just be careful, as the pin numbers might be different on the board, then in the IDE. Also check the higher number pins.

There are two things I do; I use the Serial.print(F("string/n")); which prints the data from flash rather then copying it to ram.  Keep as many of your variables local as possible, that will save ram.  This is done by defining then in the function, the added advantage nothing outside the function can change them.
Global and Static variables are the first things loaded into SRAM. They push the start of the heap upward toward the stack and they will occupy this space for all eternity.
Variables created in functions, are dynamically allocated objects and data. Unlike Global and Static variables, these variables can be de-allocated to free up space at function exit. But Every function call creates a stack frame that makes the stack grow toward the heap. This data is usable within the function, but the space is 100% reclaimed when the function exits!

Thanks for your answer, although I'm not really asking for hints on saving program space.


text:
motor affecting time calculation between hardware interrupts
My robot uses an Arduino Mega 2560. It has 6 IR receiver modules connected to its 6 external pins namely 2, 3, 18, 19, 20, and 21.I have connected the Pololu MC33926 dual motor driver arduino shield to my arduino(here is the connections diagram : https://www.pololu.com/docs/0J55/3.c ). I generate a 56KHz IR signal with an LED from another Arduino. The IR receiver modules convert the 56KHz signal into a active low digital signal. My signal consists of a signature bit followed by 32 bits of data. a binary 1 is represented by a signal of length 1200 uS and a binary 0 is represented by a 600uS signal with intervals of 600uS. I employed a state machine in my code which checks the duration of time between falling edge and rising edge. and vice versa and compares it to the duration expected. If anything is not expected it discards as noise and goes back to the idle state. If the duration is as expected it goes to the next state and then takes in the entire 32 bits and converts this binary format into a decimal value. I print this value on a 7 segment display on my robot. It works perfectly when the motor's are not running.
      Now this is the case when the motors are running. It does not receive the signal. I have tested every component individually and these are the results:

The receivers still receive the signal perfectly, and their output to the Arduino is also as expected. No problem there.
Earlier the Arduino was being powered through the Motor driver. Just to make sure that was not the problem I separated the Arduino's power supply from that of the motor driver. Still the same issue, i.e. the robot does not receive a valid signal(at this point i realized the arduino receives a valid signal but isnt able to decode it accurately).
We then printed out the values of time differences between each rising and falling edge on the interrupt pins. These values seem correct and within the tolerance range when the motors are switched off. But when the motors are switched on these values are not right. Of the 32 duration's measured, atleast two are not right(for eg. instead of 300 uS it calculated 88uS) due to which the signal is being discarded as invalid.
I thought that the PWM being generated to control the speed of the motors on digital pin 9 and digital pin 10(OC2B AND OC2A). Even though the PWM signals were being generated(without the motors connected) the signal was still being read as valid and the robot was receiving the signal. So its not that either.

The only anomaly I have found are the readings of the durations of the interrupt intervals. Can somebody please tell me what connection I have done wrong. Its mostly not with the program since it works otherwise. Something with the motor is making the Arduino act weirdly. Any help will be greatly appreciated. I have to scale up these robots to build a swarm and I am still stuck in the first step.
Thanks a lot.

Noise from electromagnetic sources is always an important issue that must be addressed. The aims are to minimise noise generation at source, reduce transmission of noise between source and the "target" affected circuitry and reduce noise impact at the target.
Motor controller circuit diagram here
The shield power supply link MUST have been removed.
Shield must have all own powering.
Coupling via a common eg 5V supply has a high chance of being problematic.
The two 5V supplies (arduino & shield) could have a common higher voltage source but need separate regulators and proper noise removal in each supply.
Placing extra capacitance across the arduino Vin or main power source MAY help.
I assume that the motors are driven in either direction during operation. If not then a reverse diode across the motors should help.
If bidirectional,  try reversed diodes from each motor lead to Vout (= V+ motor drive voltage).
The shield's Vout filter capacitors C7 & C8 care 47 uF each.
Vout could usefully have 1000 or so uF added somewhere on the board.
I do not know how much motor current is drawn and exact control strategy. This MAY interfere with motor drive but probably not: Identify one motor which "has issues". Add a small series resistance in each lead with a capacitor across the leads on the motor side. Here "small" means "does not noticeably affect performance". eg 1 Ohm if Imotor < to << 1 amp. Capacitor needs to be biplar for bidirectional motor control - eg a 1 uF ceramic or plastic (polyester, mylar, ...) cap.
'If all else fails'[tm] opto coupling the driver interface is possible BUT should not be needed.
Try above.
Report.
Ask more questions if needed.

Thanks for the above answer. It got me thinking on the right track. After some reading through the motor driver data sheet I realized that I forgot totally about the by-pass capacitors. After connecting a 0.1uF cap between two terminals of the motors and another two between the terminals and the casing the results are much better. It can receive a valid signal from another robot(though not as well as when the motors are turned off). Any suggestions where else I could place by pass cap's to further eliminate electrical noise?
Again,
Thanks a lot guys.
really appreciate the help.

In the other places I mentioned.


text:
What should the frequency reading of the SPI clock be with this code?
My Extech EX330 multimeter is reading 3.439Mhz on the pin 13 on my Arduino Uno running the following code. Is the reading correct? If the divider is 2, shouldn't I get 8 Mhz (16Mhz / 2)?
    #include <SPI.h>
void setup()
{
  pinMode(13, OUTPUT);

  digitalWrite(13, HIGH);
  SPI.begin();
  SPI.setClockDivider(SPI_CLOCK_DIV2);

}
void loop()
{

  byte pot = B0;
  SPI.transfer(pot);                        //  Do SPI transfer of variable pot
}

Yes, the clock speed should be (and most probably is) 8 MHz.  However, you're not generating an 8 MHz clock.
What you are in fact generating is 8 clock pulses of 8 MHz, then you have a delay while it deals with the rest of your code, and then it generates another 8 clock cycles of 8MHz.
The overall frequency is evidently sensed as 3.439 MHz.
To generate a pure 8 MHz clock you would have to use a different transfer method. I don't know if the 328P has DMA available, but if it does, that would give you much faster transfers.  Also, you could write a more non-blocking version of SPI.transfer().
The normal SPI.transfer() first starts the transfer, then waits for the transfer to finish, and returns the results of the transfer.  If you're only interested in transmitting, and not receiving, or the transmitted and received data don't need to c correlate completely, you can instead change the order of how it works:

Wait for there to be no transfer in operation
Store the result of the last transfer
Start the new transfer
Return the results of the last transfer.

That way it runs much smoother as it's doing the current transfer at the same time as running your other code.

No, because neither the allocation and assignment of pot nor the call to SPI.transfer() come for free. And the time taken by both slows the average frequency down to about the measured value.


text:
Connecting multiple DHT 11 sensors
I want to collect data (both Humidity & Temperature) from 80 sensors. let's say I have 80 "DHT 11 Humidity & Temperature" sensors (for ex. in a warehouse) and one Arduino Uno R3 pack. It's clear that arduino has no so many pins to connect. I'm sorry that I don't know if it's possible. If so, what can I use to achieve this?
Thank you all for your suggestions.

Probably it may be possible with multiplexing but I don't know which multiplexer to use and how to connect multiplexer :(

80 sensors would means some sensors will have a few tens of meters of wire. You'll run into data integrity issues with that long a cable. Also might I suggest the DS18B20. No humidity, but better precision. Every sensor has its own 64-bit unique address, so you can have multiple sensors on one data line. It doesn't even need a separate power line.

Analog multiplexers are one way, but they tend to have a significant resistance when on, and this could cause the protocol not to work.
For 80 channels you need 7 bits addressing. Say you have an 8-input multiplexer, then a 3-bit address indicates which of the 8 inputs is selected. Use 10 of these, all with the three address lines connected, and you have 10 outputs from 80 inputs.
Next, use a 16-input multiplexer to select which of the 10 inputs you want to use. For this multiplexer you need 4 address lines. Together with the other 3 address lines you have 7 address lines, enough to select 1 of up to 128 sensors. But I repeat, this approach may not work if the multiplexer's resistance is too high.
A more robust (albeit more expensive) is to use analog switches to connect/disconnect each sensor. Analog switches (Analog Devices has a lot of them) have on-resistances down to < 1 ohm, so the sure should be OK for the application.
To control the long series of switches you could use a daisy chain of 74HC595 shift registers, which only requires a couple of I/Os on your controller, but gives you virtually unlimited outputs.

I think 74HC595 shift registers will be good choise :) thank you very much for your answer


text:
Arduino Pro mini to CH340G Connection problem
I have worked with Arduino UNO but recently I bought a new Arduino Pro mini 5v 16M and a CH340G converter to work with. I have searched google to connect pins but I found examples that explains this way :
GND to GND
VCC to VCC
Converter RDX to Arduino Pro Mini TXO
Converter TDX to Arduino Pro Mini RXI
My problem is that my Arduino Pro Mini (328p) has pins TXD and RXD (not RXI , not TXO) or maybe I have no knowledge about TX,RX, IN and OUT.
Can someone please help me to connect these wires?

Generally, lines with names like TX, TXO, and TDX are for serial-data transmit, and  lines with names like RX, RXI, and RDX are for serial-data receive.
Connect transmit on the CH340G board to receive on the Pro Mini, and vice versa.
For typical serial-converter programmers (I don't know specifically about the CH340) you need to connect CTS (Clear to Send, if the programmer has it) to the pin next to BLK on the Pro Mini, and RTS to GRN (DTR).  The RTS-to-DTR (Request to Send, Data Terminal Ready) connection lets the programmer auto-reset the Pro Mini to start programming.
See yourduino.com's ProMiniPinout.png diagram.

Thank you very much for this detailed answer. RTS-to-DTR connection helped me so much :)

try reversing the tx/rx lines, if the PRO Mini and serial adapter are chinese, you may want to try using your UNO as ISP programmer. See here for a hint/ex:
https://www.arduino.cc/en/Tutorial/ArduinoISP


text:
Is there a radar - like sensor that can tell me the distances of multiple things around the sensor?
I'm trying to develop something that requires accurate distance measurement of objects around the center of the contraption. However, I cannot find any way to achieve this other than using a bunch of infrared distance sensors. Really, I'm looking for something that costs at most $200 and is compatible either with arduino, PC, or raspberry pi.
This may not be the place for this, if not, please inform me.
Thanks in advance!

If seen people put an ultrasonic sensor on a serve. By moving the servo you can "scan" the surroundings. It is however a bit slow.

What you're looking for is called lidar - but it's not cheap. RPLIDAR is the current price leader for non-hacky solutions, and I haven't seen it for much less than $400 anywhere.

Wait so would you suggest just using the infrared distance sensors then?

I don't know your application, so I can't answer that.


text:
5 Switches 1 AI pin
Im starting to get into Arduino a little. Ive got a Small project to start me off,
To keep it simple its: 5 level Switches, 1 flow switch and 3 solenoid valves.
This question is for the Level Switches.
Now Im wanting to save Pins as I'm using a Arduino UNO.
So would I be right to use the method ive seen around here a few times of Making a Resistance  ladder.
Question is. 1- Will the method of using the same value of resistors (2k2) work? I dont think so..
As multiple "buttons" ie the flot switches will be pressed at once it will end up having no idea whats happening correct?, I need to be able to Identify each one (0%,25% etc etc)
If I was to use different vales of resistance would that make a difference ?
Cheers

Just look at this answer. When you press the LEFT switch, the SELECT button has no effect when pressed (i.e. it doesn't get detected, but also doesn't hinder detecting the LEFT button press). So in your case, you aren't really interested in the 0% button, when the 25% is pressed.
I wouldn't use same value resistors, as the resulting voltages would be non-linear, making it difficult to differentiate between the button at the far end ladder. If you'd use 2k2 everywhere, the voltages would be

100% 0.00v
75% 2.50v
50% 3.33v
25% 3.75v
0% 4.00v
no value: 5v

In the answer provided above, voltages would be: 0, 0.71, 1.61, 2.47, 3.62, 5v

authors: Шевченко Владимир


text:
Arduino Uno (master) and ATTiny85 (slave) I2C connection not working
I am trying to send and receive data using I2C between an Arduino Uno and an ATTiny85. The Arduino Uno is using the Wire library. The ATTiny85 is using the TinyWire library and is programmed (and powered) using the Sparkfun Tiny AVR Programmer.
I am not receiving any data.
Arduino Uno I2C master code
#include <Wire.h>

#define SLAVE_ADDR 0x50

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}

void loop()
{
  Wire.requestFrom(SLAVE_ADDR, 1);

  while(Wire.available())
  {
    byte byteReceived = Wire.read();
    Serial.println(byteReceived, DEC);
  }
}

ATTiny85 I2C slave code
#include "TinyWireS.h"

#define SLAVE_ADDR 0x50

void setup()
{
  TinyWireS.begin(SLAVE_ADDR);
  TinyWireS.onRequest(requestEvent);
}

void loop()
{
}

void requestEvent()
{
  byte byteToSend = 23;
  TinyWireS.send(byteToSend);
}

I modified your Uno sketch slightly to add a delay:
#include <Wire.h>

#define SLAVE_ADDR 0x50

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}

void loop()
{
  Wire.requestFrom(SLAVE_ADDR, 1);

  if (Wire.available())
  {
    byte byteReceived = Wire.read();
    Serial.println(byteReceived, DEC);
  }

 delay (1000);
}

Upon testing, it worked perfectly!
23
23
23
23
23
23
23
23
23
23
23
23

I suggest a wiring error. Check you have:
Uno    ATtiny85
--------------------
A4      pin 5  (SDA)
A5      pin 7  (SCL)
+5V     pin 8
Gnd     pin 4

I think the problem is (assuming you've got the pins straight) is that there's no time for the byte to get to the Uno.  Try while(!Wire.available()) between requestFrom... and the while(Wire.available())

Wire.requestFrom does not return until data is available, or if the slave device cannot be found. It returns the numbers of bytes available.


text:
Choosing right Sleep state
I'm planning on building an LED clock, but I want it to be lit only when I press the POWER button on my remote control. Using an IR receiver, which Arduino sleep mode should I use to reduce the current consumption but still be able to receive this interrupt?

Please be aware that, if you are using an Arduino board -ie you did not build your own- then you have a minimum consumption that you cannot reduce, e.g. due to voltage regulator current leakage, or (for UNO) ATmega16u2 is always running (for USB handling).

Also the IR-receiver uses something like a milli-amp. And then there is the power-on led.

@jfpoilpret Thank you I'm aware of that but at least I can consume a little bit less during the whole day.

You can drive the vcc directly by-passing the on board linear regulator. You can directly drive it with 2(2.8v), 3(4.5v) or 4(6v) for AA's. Note the ATMEGA328 is 6v and TSOP38238 is 2.5 to 5.5v

Related question has an answer by me with example code.

I recommend reading ArduinoSleepCode. Where it demonstrates placing the avr into a sleep state and using an interrupt to awake from the sleep state. In your case you can connect the output of your IR demodulator to the interrupt  pin, to simular awake.
Ken Shirriff's IR library allows you to use any pin as a receive input, so that you can use INT0 or 1 on D2 or D3. If you need to use a different pin, the Microtheron's github fork uses Pin Change interrupts. (I am not sure if stock sleep.h will awake from PCint, like int0 or 1 will, without tweek. Section 10.1 of data sheet says it will.)

You can only wake from INT0 and INT1, and only using the LOW trigger-mode; no PCINTs. The only problem is staying awake for a moment, while all the IR data is coming it, as the library you propose uses timer1 to sample the data coming in.

@Gerben I didn't think of that, while I'm pressing for the first time the POWER button the Arduino is still sleeping so it could miss some data, am I right?

Note the bootloader from any reset typically takes 5 seconds before executing the setup () followed by loop ().

Most ir protocols have a long initial pre-amble, before the data part to allow settle time for waking up. Where sherrif's already learned protocols require this in entirety. And as you noted it will be partial, at first. Where sherrif's ir library could be adjusted for this.

My thougt was to wake up from the intitial space (pre-amble) and start so that timer1 can resume. Alternatively one can tweak the lib to  either go back to sleep if no ir is present otherwise stay wake. This will only be awake for a moment every 50ms. This will extend life a long time (years). Many systems do such.

I still didn't get your answer because the commentaries here seems to me (Im very noob on this) that you cant use that library for this?

could anyone (sorry for asking) can write some dummy code to get the idea?


text:
How to send data to sim900 only once in loop()
I am trying to communicate with a client(PC) from my arduino (set up as a server with a sim900 module connected via UART). I have successfully got it to register its IP address with a dynamic DNS provider (no-ip.com) and set up a TCP server using the AT+CIPSERVER command for the sim900. All this is done in setup(). After that in loop() it waits for a client to connect. The moment a client connects the problem arises. The code is:-
void loop()
{
  while(Serial.available() <= 0);
  int x=0;
  char server_recv_string[30];
  while(Serial.available()>0)
  {
    server_recv_string[x] =  Serial.read();
    delay(10);
  }
  Serial.println(server_recv_string);
  sendATcommand2("AT+CIPSEND",">","ERROR",1000);
  sendATcommand2("I hear you\x1A","SEND OK","ERROR",5000);
  while(Serial.available()>0)  // I dropped this in to clear out the input buffer.
  {                            // Doesn't help
    Serial.read();
    delay(10);
  }
  Serial.flush();
}

The sendATcommand2 is a function as given below. I don't think that has any fault in it because it seems to work fine for all the other commands in setup. However this is the code:-
int8_t sendATcommand2(char* ATcommand, char* expected_answer1,
    char* expected_answer2, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialize the string

    delay(100);

    while( Serial.available() > 0) Serial.read();    // Clean the input buffer

    Serial.println(ATcommand);    // Send the AT command

    x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        // if there are data in the UART input buffer, reads it and checks for the answer
        if(Serial.available() != 0 && x < 100){
            response[x] = Serial.read();
            x++;
            // check if the desired answer 1  is in the response of the module
            if (strstr(response, expected_answer1) != NULL)
            {
                answer = 1;
            }
            // check if the desired answer 2 is in the response of the module
            else if (strstr(response, expected_answer2) != NULL)
            {
                answer = 2;
            }
        }
    }
    // Waits for the asnwer with time out
    while((answer == 0) && ((millis() - previous) < timeout));

    return answer;
}

The when I monitor it on the serial terminal I get infinite sends to my client. Its like this:
 AT+CIPSEND
 I hear you

 AT+CIPSEND
 I hear you

 AT+CIPSEND
 I hear you

 AT+CIPSEND
 I hear you

 // And on and on and on.

Any idea why this is happening? If you guys need any more information, please do tell me.
Thanks
Taz

I don't see what your problem is really, canyou explainfurther what you would expect from your code?

You can use a boolean variable to decide if you are going to execute the send command. You can set the variable to true in the setup and to false after the command is executed.
If you introduce the send call inside an if (your boolean variable == true), it will only be executed in one loop iteration.
You can execute it again anytime you like setting the variable to true at any moment.

Thanks! Unfortunately that itself didnt help me. For some reason even when I add a flag, the flag sets over and over again when serial.available() is greater than zero. Couldn't figure out why. So i combined setting the flag and after finishing all my tasks forcefully cleared the input buffer with Serial.end() and Serial.begin(9600). I guess this isn't neat but it works for now. I'll investigate further though.


text:
How to Communicate between arduinos wirelessly?
I am doing a project where I need to send some numbers between arduinos. But it has to be wirelessly because they will be moving. How to Communicate between arduinos wirelessly? I need to send data between them. Wifi would be preferred.
Thank You.

nRf24l01+ is one simple option, what size of data, at what speed and distance?

There is also the ESP8266 which provides easy access to WLAN and can be used to setup an access point.

The speed at most will be around 2-5 mph. Distance will be about 20ish feet

Wifi would require an active wifi access point around.
I would go by either RF which is fast, long range (they use this in the radio-controlled cars) or go with bluetooth, which makes it fun to optionally control them by phone/bluetooth. But it has a little smaller range and I have no idea how to connect two of these together

As has been mentioned in the comments, you have at least three possible solutions:

Wifi using the ESP8266
Private protocol using the nRF24
Bluetooth using the HC-05

All of these will handle 20 feet of separation.  All of these have high quality libraries for Arduinos and lots of free tutorials and assistance via forums and Stack Exchanges.
Some of the primary differences are price, size of data and power consumption.
My personal weapon of choice, and not knowing anything further about your project ... is the nRF24.  This is crazy cheap and pretty easy to use.  It also benefits from no need for a Wifi access point and also has a broadcast capability so that multiple devices can receive the same message.  The down sides are that it is a private protocol that your phone and laptop can't decode natively (it isn't WiFi).
My second choice would be Bluetooth.  This would allow your phone and laptop to be transmitters and receivers as there are plenty of great Bluetooth terminal emulators available.

Yes - and there's really no reason to pay the 2x-3x premium for wifi or bluetooth when both ends are ATmega-based Arduinos.  If one end were a PC or a phone or other gadget already having one of those radios then using something that it already supports would make sense - but when you get to define both ends, pick something simple.

You can use XBees. They are powerful and do provide wifi connections (the recent versions).
And you rely on well-designed devices which guarantee packet retransmission and they achieve up to 1km in an open field.
XBee still works with serial communications making them an excellent tool for your embedded project.
Just plug your Arduinos and write code to send/receive data. This library is a good start point for API mode.
If you don't mind using all the benefits from ZigBee protocol, just use AT mode where all you push in one side is sent to another via serial communication.


text:
Arduino bluetooth module as a server
I was looking around becouse I need to simulate a OBDII device. I think about to use Arduino for that. I was reading some tutorials how to use bluetooth module but I didn't find any tutorial when Arduino is a server. Alway Android app is a server. Is there way to put SP server in Arduino and Android as a client? And do I need special shield/module for that? If you could gave me some links to tutorials or code would be grate.
Interesting for me would be also possibility to send data form computer by USB to Arduino then Arduino push it forward to Android. - but that is not must have, first possibility is more importand for me.

You should say which bluetooth module you have. Some are client only others are client/server. All the server modules need to be configured as a server normally using AT commands.

I dont't buy yet, I wanted to ask first

There are two types of bluetooth devices for Arduino. Some are "slave" only and some are both "master or slave".
There is little difference in price so you should buy one that is master or slave.
This page (HC-05) describes one that appears to be commonly used but there are many and I do not have a recommendation. Some devices are in the form of small boards which connect to the pins on the Arduino (normally serial tx/rx) and some are shields that plug onto an Arduino. The article also shows the connection.
This appears to be an ODBII bluetooth arduino forum thread that uses bluetooth and ODBII. Video
By default Android is in bluetooth master mode. This article appears to show the Android programming required to enable a bluetooth slave.


text:
Can I make the Arduino ignore serial print
I like having serial communication for debugging and testing purposes but after a while it takes away too much speed from the sketch.
Is it possible to have the Arduino ignore serial.print and serial.println throughout my code, without turning it into a comment or placing every serial printing inside for example "if(debug == true)" statements?
Thanks in advance.

If you insist on top performance, the best thing would be to use a macro for that:
#define Sprintln(a) (Serial.println(a))

Then instead of
Serial.println(F("Hello world!"));

write
Sprintln(F("Hello world!"));

etc. To deactivate the Serial printing, define the macro empty:
#define Sprintln(a)

This will have the preprocessor remove all debugging code defined with Sprintln from your code.
(Of course, there's a huge number of variations on this theme.)

You can also wrap all exiting prints in #ifdef ENABLE_PRINT and #endif and then define or comment out #define ENABLE_PRINT at the top of ur file

You can even set a debug level and define macro's for debugL1();, debugL2(); etc, so you can choose how many details you want to "log". The macro's will though make it unable to change runtime, but at the advantage of not having runtime overhead.

You could, for example, use the preprocessor to change all Serial in your code.
#ifndef ENABLE_PRINT
// disable Serial output
#define Serial SomeOtherwiseUnusedName
static class {
public:
    void begin(...) {}
    void print(...) {}
    void println(...) {}
} Serial;
#endif

Yet another solution is to implement a dummy Serial device. That would be a class that as HardwareSerial inherits from Stream and implements the necessary virtual member functions with dummy functions.
class NullSerial : public Stream {
public:
  virtual size_t write(uint8_t) { return (1); }
  virtual int available() { return (0); }
  virtual int read() { return (0); }
  virtual int peek() { return (0); }
  virtual void flush() {}
  ...
  void begin(unsigned long, uint8_t) {}
  void end() {}
  ...
};

NullSerial Serial;

As Serial is not defined as a weak symbol the application would need to use a Steam variable for output. And bind this to the HardwareSerial or the NullSerial.
#if defined(DEBUG)
Stream& trace = Serial;
#else
NullSerial noSerial;
Stream& trace = noSerial;
#else

#endif
...
trace.print(42);

This is not complete as all the HardwareSerial member functions (that the sketch uses) are needed but gives the general idea how to use OOP to solve the problem.
Cheers!

This worked well for me (great for debugging in PlatformIO!). Instead of declaring NullSerial Serial (which conflicts with the HardwareSerial declaration by the same name), I gave it a unique name (NullSerial nullSerial) and then overrode the original everywhere with #define Serial nullSerial. Lovely thing about this method is that my existing code does not change.


text:
FreeRTOS Implementation on Arduino
I am trying to make an RGB LED with Fan Controller for PCs. It is an Open Sourced project. But I want to implement RTOS using this implementation of it as a function in it, namely rollColor(), takes a lot of cycles.
The data the Arduino uses comes from the Serial. The Serial data has to wait until the function rollColor() completes. This function also has a delay and total runtime of this function is approximately 20 Seconds.
This is the original code, in which RTOS is not implemented: nonRTOS
Now I don't want to give a consecutive 20 seconds of execution time to a single function, but time slices would be good.
Now this falls under (RT)OS category and I would like to utilize this library but I seem to be unable to do that as there is not much documentation to begin with. The code I have come up with is this:
#include <Arduino_FreeRTOS.h>
#include <LCD.h>
#include <LiquidCrystal_SR.h>

#define FAN1 3
#define FAN2 5

#define LEDR 6
#define LEDG 9
#define LEDB 10

#define LCD_DT 14
#define LCD_CK 15
#define LCD_EN 16

#define E_FAN1 0
#define E_FAN1 1

#define SAMPLE 100

#define E_RGB_START 2
#define E_RGB_END 502

LiquidCrystal_SR lcd(LCD_DT, LCD_CK, LCD_EN);

int led[2][6];
int led_type = 0;
int led_bright = 0;
int fan[2] = {50, 50};
int load[3];
int temp[2];
int gradient[SAMPLE][3];

bool fchange = false;
bool lchange = false;

void TaskPrintLCD( void *pvParameters );
void TaskRGBCycle( void *pvParameters );
void TaskFanSpeed( void *pvParameters );

void setup() {
  Serial.begin(57600);
  xTaskCreate(
    TaskPrintLCD
    ,  (const portCHAR *)"Print_To_LCD"  // A name just for humans
    ,  128  // This stack size can be checked & adjusted by reading the Stack Highwater
    ,  NULL
    ,  2  // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
    ,  NULL );
  xTaskCreate(
    TaskRGBCycle
    ,  (const portCHAR *)"Cycle_RGB_Colors"  // A name just for humans
    ,  128  // This stack size can be checked & adjusted by reading the Stack Highwater
    ,  NULL
    ,  3  // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
    ,  NULL );
  xTaskCreate(
    TaskFanSpeed
    ,  (const portCHAR *)"Set_Fan_Speed"  // A name just for humans
    ,  128  // This stack size can be checked & adjusted by reading the Stack Highwater
    ,  NULL
    ,  1  // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
    ,  NULL );
}

void loop() {

}

void TaskPrintLCD(void *pvParameters) {
  (void) pvParameters;
  Serial.println("LCD Settings...");
  lcd.begin(20, 4);
  for (;;) {
    printCPUUsage(load[0]);
    printGPUUsage(load[1]);
    printRAMUsage(load[2]);
    printTemps(temp[0], temp[1]);
  }
}

void TaskFanSpeed(void *pvParameters) {
  Serial.println("System Started...");
  Serial.println("Setting Pins...");
  pinMode(FAN1, OUTPUT);
  pinMode(FAN2, OUTPUT);
  (void) pvParameters;
  for (;;) {
    if (fchange) {
      Serial.println("SETTING FAN SPEED");
      int speed1 = ((fan[0] * 256) / 100 ) - 1;
      int speed2 = ((fan[1] * 256) / 100 ) - 1;
      fchange = false;
    }
  }
}

void TaskRGBCycle(void *pvParameters) {
  (void) pvParameters;
  pinMode(LEDR, OUTPUT);
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
  for (;;) {
    if (led_type == 1) {
      //ROLLCOLOR() FUNCTION START
      Serial.println("ROLLING GRADIENT START...");
      for (int i = 0; i < SAMPLE; i++) {
        analogWrite(LEDR, gradient[i][0]);
        analogWrite(LEDG, gradient[i][1]);
        analogWrite(LEDB, gradient[i][2]);
        vTaskDelay(100 / portTICK_PERIOD_MS);
      }
      for (int i = SAMPLE - 1; i >= 0; i--) {
        analogWrite(LEDR, gradient[i][0]);
        analogWrite(LEDG, gradient[i][1]);
        analogWrite(LEDB, gradient[i][2]);
        vTaskDelay(100 / portTICK_PERIOD_MS);
      }
      //ROLL COLOR FUNCTION END
      Serial.println("ROLLING GRADIENT END...");
    } else {
      analogWrite(LEDR, led_bright);
    }
  }
}

void serialEvent() {
  Serial.readStringUntil('*');
  while (String main = Serial.readStringUntil('>')) {
    Serial.println("IN WHILE");
    Serial.println(main);
    if (main == "") {
      break;
    }
    String data;
    if (main == "leds") {
      lchange = true;
      int type = Serial.readStringUntil(':').toInt();
      led_type = type;
      if (type == 1) {
        Serial.println("LED TYPE: " + led_type);
        for (int i = 0; i < 6; i++) {
          data = Serial.readStringUntil(',');
          Serial.println(data);
          if (i < 3) {
            led[0][i] = data.toInt();
          } else {
            led[1][i - 3] = data.toInt();
          }
          data = "";
        }
        generateGradient();
      } else {
        led_bright = Serial.readStringUntil(',').toInt();
      }
      Serial.readStringUntil(';');
    } else if (main == "fans") {
      fchange = true;
      for (int i = 0; i < 2; i++) {
        data = Serial.readStringUntil(',');
        fan[i] = data.toInt();
        data = "";
      }
      Serial.readStringUntil(';');
    } else if (main == "stat") {
      for (int i = 0; i < 2; i++) {
        data = Serial.readStringUntil(':');
        if (data == "load") {
          for (int j = 0; j < 3; j++) {
            data = Serial.readStringUntil(',');
            load[j] = data.toInt();
            data = "";
          }
          Serial.readStringUntil(';');
        } else if (data == "temp") {
          for (int j = 0; j < 2; j++) {
            data = Serial.readStringUntil(',');
            temp[j] = data.toInt();
            data = "";
          }
          Serial.readStringUntil(';');
        }
      }
    }
  }
}

void printCPUUsage(int usage) {
  int loc;
  int i;
  lcd.setCursor(0, 0);
  lcd.print("CPU% ");
  for (i = 1; i <= ceil(usage / 10); i++) {
    lcd.write(255);
  }
  for (i; i <= 10; i++) {
    lcd.print(" ");
  }
  lcd.print(" ");
  if (usage > 99) {
    lcd.print(usage);
  } else {
    lcd.print(" ");
    lcd.print(usage);
  }
  lcd.print("%");
}

void printGPUUsage(int usage) {
  int loc;
  int i;
  lcd.setCursor(0, 1);
  lcd.print("GPU% ");
  for (i = 1; i <= ceil(usage / 10); i++) {
    lcd.write(255);
  }
  for (i; i <= 10; i++) {
    lcd.print(" ");
  }
  lcd.print(" ");
  if (usage > 99) {
    lcd.print(usage);
  } else {
    lcd.print(" ");
    lcd.print(usage);
  }
  lcd.print("%");
}

void printRAMUsage(int usage) {
  int loc;
  int i;
  lcd.setCursor(0, 2);
  lcd.print("RAM% ");
  for (i = 1; i <= ceil(usage / 10); i++) {
    lcd.write(255);
  }
  for (i; i <= 10; i++) {
    lcd.print(" ");
  }
  lcd.print(" ");
  if (usage > 99) {
    lcd.print(usage);
  } else {
    lcd.print(" ");
    lcd.print(usage);
  }
  lcd.print("%");
}

void printTemps(int cputemp, int gputemp) {
  lcd.setCursor(0, 3);
  lcd.print("TEMP ");
  lcd.print("CPU ");
  if (cputemp < 100) {
    lcd.print(" ");
  }
  lcd.print(cputemp);
  lcd.print(" GPU ");
  if (gputemp < 100) {
    lcd.print(" ");
  }
  lcd.print(gputemp);
}

void generateGradient() {
  Serial.println("GENERATING GRADIENT...");
  float m[3];
  int r, g, b;
  m[0] = (led[1][0] - led[0][0]) / SAMPLE;
  m[1] = (led[1][1] - led[0][1]) / SAMPLE;
  m[2] = (led[1][2] - led[0][2]) / SAMPLE;
  for (int i = 0; i < SAMPLE; i++) {
    r = ceil(m[0] * i) + led[0][0];
    g = ceil(m[1] * i) + led[0][1];
    b = ceil(m[2] * i) + led[0][2];
    gradient[i][0] = r;
    gradient[i][1] = g;
    gradient[i][2] = b;
  }
  lchange = false;
  Serial.println("GRADIENT GENERATED...");
}

To me this code seems complete, but there is nothing from Arduino end, no LCD print nothing. I may be doing something wrong, but I don't know what, so please advice.
If you have any other better alternative please advise that too.
PS: I wrote this in two sittings so there might be something amiss so please feel free to edit or ask any questions for clarification.

Your printXXXusage functions could all be rolled into one function with an extra parameter in, this would mean you would only have to fix errors (if there are any) once.  As to your problem it sounds like you should use interrupts and I don't know if you can do it with RTOS.

@Matt yeah... I can.. but i will do that once this time division is done. BTW there are 3 timers and all of them are being used for the PWM Signals so what interrupt can I use for time division or slices?

@Matt BTW forgot to mention, there are no errors in the nonRTOS code, only this implementation which I am not sure if I am implementing correctly.


text:
Arduino Mega 2560: Busted Atmega 16U2
I just bought an Arduino Mega2560 R3 and it doesn't connect to my Laptop. The connection is somewhat random, sometimes it connects and sometimes it doesn't.
Can someone help me identify whats the problem?
When it gets connected I can upload sketches.
I would like to remove the Atmega 16U2 and replace it with ftdi USB to Serial, would it be possible?

Did you try another USB port / another PC?

Also, the cable might be the problem. Check for that.

Yes I did both. The connection was random, now it doesn't connect at all, only an error. I can get it into DFU mode but Atmel Flip says usb device cannot be connected.

Do you have an ISP programmer / another arduino

I have bought an I |SP programmer but it will take 3 weeks to reach and no I dont have another arduino, TBH I'm scared to buy another one. I am buying an FTDI USB to TTL/Serial, could that help?

The serial cable will help to program the actual 2560 chip itself. IS the Arduino clones that you bought.

@RSM Its an original one.

You can use your USB/Serial adapter to program the 2560 as the Arduino uses the 16u2 as the same thing to program the mega. You shouldn't remove the 16u2, just wait till you get the programmers and reflash the 16u2 with its firmaware and it will work, I actually had the same problem where the DFU didn't work and the 16u2 stopped responding, after reflashing the firmware it worked. The firmaware can be found under(as of 1.6.0):
...\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2\MEGA-dfu_and_usbserial_combined.hex
You need to connect the Serial pins on the FTDI and Mega in the below fashion:
 FTDI           MEGA
 GND<----------->GND
 CTS<----------->GND
 VCC<----------->VCC
 TXD<----------->RX0
 RXD<----------->TX0
 RTS/DTR<---||-->RST

The Capacitor between the DTR pin and RST pin are needed this should be 100nF.

I have bought an I |SP programmer but it will take 3 weeks to reach and no I dont have another arduino, TBH I'm scared to buy another one... –  echo_salik

If you are buying clones, those will more than likely give issues as they will be cutting back on costs in places, i.e. QC checks.

Actually the ISP is a normal one but the shipping takes time to my country. I'll try this out and let you know. How will I flash it, like what software will I use to flash it? Arduino Studio will work with it?

@echo_salik - you can use avrdude to flash the 16u2, there are a few tutorials on using it, I will add a link when I'm back at a PC

On my USB to Serial Module, it just have the following pins: 3V3 - TXD - RXD - GND - +5V Its a USB to TTL device. Could that work?

@echo_salik I think that should work, you will just be doing some fancy finger work, you will still connect serial lines as normal and the power, but on upload you will need to push reset on the board manually.

@echo_salik - brain fart, if your USB-serial chip is exposed, and you can get the pin put, see if you can solder a wire to the DTR pin? Just if the other way fails to upload.

well, TBH i think I ruined my USB-TTL, I am following this http://kaushleshchandel.com/wordpress/?p=194. No great with soldering on such small pins.

@echo_salik aside, is the board warrenty/guarantee still valid for an exchange, because if the board started out with a fault when you first used it you should be able to exchange the board. Also what seems to be the problem with the PL2303 board?

No problem, Luckily its working. I was able to unfu** (can't think of a more suitable word) it somehow. But cant upload. For how long should I hold reset?

@echo_salik - if you are just using the cable without the mod, hold it down until you see the status say 'uploading' and then release. Or push it once as it says uploading. You just have to get the timing right at that point. Again do you know if you would still be able to get the board exchanged? Thus would be a option if this gives you a bad experience.

No the items are not exchangeable. But i'll keep it for some more projects. Might come handy in future. I did buy the com port one. I'll post result with it soon.

I finally got my ATtiny44 Programmer and got it installed in Windows 8.1x64. it is listed as Atmel USB Devices > USBtiny. When I flash it I get the error usbdev_open(): did not find any USB device "usb" . What should I do?

@echo_salik - cool dude ;)

I still get the error for Arduino Device descriptor failed after successfully flashing the 16u2. So the uC is busted right?

@echo_salik - is this when you plug the board back in?

Yeah... If got flashed correctly: AVR dude Image But I still get this Device Manager

Forgot to mention, I got it to work with my USB to TTL.

@echo_salik - maybe try reinstall the drivers for the mega, the chip seems to have flashed correctly from the screen shot.

Let us continue this discussion in chat.


text:
Getting started
so I am not a newbie to computers or programming. I regularly program in C# and Java, know quite a bit about computer hardware and operating systems. But I am bored of writing stupid calculators or game bots. I want something exciting and something that involves physical hardware. So I want to get into electronics and micro-controllers. I was wondering how I should go about this? Any topics I should read first? How electrics work maybe? Any guides I should skim over? I plan to buy the Arduino starter kit and a load of components, along with a soldering iron etc soon; but want to get reading now. I do not need to go right into the advanced stuff but I like to know how things work before I use them; not just "plug this wire here to do this". Any help is much appreciated.

Here you go.

Just think of a cool/useful project.  Do some research. Look at related projects others have done. And then make it. Jumping right into the deep end. No boring books with example you need to replicate. That's what worked for me. I too came from a software developer background.

The best way to get started is surely by reading a book, I would recommend

Getting Started with Arduino
Exploring Arduino

Besides, there are many tutorials on YouTube also to start with.
But books are just one thing. Arduino or electronics is more about getting a hands on experience. Even if you have read a hundred times on how to blink a LED it is difficult to do it when doing it on hardware. So the best thing for you is to work with small small codes.
Say initially just blinking a LED(thats like the HelloWorld of electronics) and then moving on two patterns with LED. As you get used to the IDE and the hardware move on to more challenging projects like simple DC motor control or servo control. Try and make your own projects with your imagination. The challenges which you face teaches you more than any book. Then move on to serial and wireless communication and try working with a few sensors on the ADC and start making small projects.

Eh. Hands-on experience is part of any technology, but without the theory to back it up you're limited to putting large blocks together unless you don't mind accidentally destroying something. Not that I'm saying that destroying things is bad per se, just that it becomes safer and easier with the theory.

A quick search on Amazon found a number of basic books on electronics. I'm not familiar with any of them to recommend one of them. But "plug this wire here to do this" isn't a bad way to start - you'll probably have some questions about what this component is for or why they had you connect it the way they did. That will give an immediate direction to your studying which in turn will bring in some more questions and more information.
If you really want some basics ahead of time (noting that I don't know what will be basic for you), you might search for Ohm's Law (voltage and current through a resistor), and Kirchoff's Laws (voltage and current in electric circuits), and follow any leads that look interesting. Look up some common components that you'd find in a starter kit, like resistors, capacitors, and LEDs. But things will begin to get "real" for you once you have parts in hand and start using them to make some basic stuff like making lights blink or fade, motors turn, and buzzers buzz.


text:
Accel Stepper help, stepper not going backwards
So my question is that I am trying to use a arduino library called Accel Stepper to control a stepper motor, I made code that makes the stepper motor move one rev clockwise and then one rev counter clockwise
however as i run the code, the motor has no problem going clockwise, however when it comes to reversing the shaft of the motor stays still and doesn't move while the whole motor itself vibrates, what could be my problem?
here is my code:
    // MultiStepper.pde
    // -*- mode: C++ -*-
    //
    // Shows how to multiple simultaneous steppers
    // Runs one stepper forwards and backwards, accelerating and decelerating
    // at the limits. Runs other steppers at the same time
    //
    // Copyright (C) 2009 Mike McCauley
    // $Id: MultiStepper.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $

    #include <AccelStepper.h>
    int user = 800;
    // Define some steppers and the pins the will use

    AccelStepper stepper2(AccelStepper::DRIVER, 9,8 );
    AccelStepper stepper3(AccelStepper::DRIVER, 4, 7);

    void setup()
    {

        stepper2.setMaxSpeed(1000);
        stepper2.setSpeed(300);

    }

    void loop()
    {
        // Change direction at the limits
      stepper2.moveTo(user);
      stepper2.setSpeed(300);
      stepper2.runSpeedToPosition();
      if (stepper2.distanceToGo() == 0){
        stepper2.moveTo(-stepper2.currentPosition());
        stepper2.setSpeed(300);
        stepper2.runSpeedToPosition();
      }

    }

Work through your code. When it gets to the target position, your loop looks like this:
void loop()
{
    // Change direction at the limits
  stepper2.moveTo(user);
  stepper2.setSpeed(300);
  stepper2.runSpeedToPosition();
    stepper2.moveTo(-stepper2.currentPosition());
    stepper2.setSpeed(300);
    stepper2.runSpeedToPosition();

}

So you say, move to position 'user', then move to position '-stepper2.currentPosition'. Then as the loop comes around you again say move to position 'user', and so on.
The loop will repeat hundreds if no thousands of times per second, so you are basically telling the stepper motor to change direction thousands of times per second which will be why the motor starts vibrating when it gets to the user position.
If, just for the sake of argument, you were to move the first three lines of code in the loop() function to the setup() function, what behaviour do you think you will observe?

okay I see however one thing I don't understand stand is that I have a condition, it is not like I am directly telling the stepper motor to change a thousand times, I was trying to have a condition in which the stepper would reach a position then once it reaches that position it will have a new target to go to then it will run to that position, however as you have said I will try to put the first 3 lines of code in my setup function and I will observe the results

also anoyher concern that i have is that if i have to input code into the setup for the code in the loop to work what if i want the stepper to do a series of movments like moving from one position to another then back to its original position and moving foward again

You have to think about how your program goes together. What inputs do you have? When do you start the sequence of movements? Do you need to do things at timed intervals. Drawing up flow charts is very useful when it comes to learning how a program is going to go together.

well yeah I need things to go at timed intervals since I am attemping at making a cnc gui where a user can input directions or measurements for the stepper to go this is why I need things to happen right after each other in intervals, the inputs for now are going to be simple directions because the cnc "gui" I planing to build is going to be very basic not to complicated just the arduino serial monitor I am going to use

to reverse the direction try passing negative speed value to speed
like
stepper2.setSpeed(-300);


text:
How to start a block of code after a certain time?
I'm using a ATMega328P-PU on a breadboard as an arduino. How do you start a code after say 20 seconds have elapsed since startup?
Example code:-
if(condition)
{
     //Start sending morse code!
}

My current code uses millis() and fails miserably. The speaker does not get activated. I'm using the standard circuit mentioned at the Arduino website
My current code:-
time = millis();
  if(time>=20000)
      txEnable=true;
      val = analogRead(analogPin);
  if(val!=0)
  {
    standby=false;

  }
  else
  standby=true;
  if(txEnable==true && standby==true)
 {

  if(!callsignSender->continueSending())
    {
        callsignSender->startSending();
    }

 }

You are comparing an analog reading with zero. Are you sure you don't mean digitalRead()? If you really need an analog value, instead of comparing with zero you should compare to some low threshold.

I'm basically writing this code for a ham wireless repeater. Its in Pune.(VU2PHA). The analog read value is for detecting any incoming signal for repeating. Its a small scale model for the same big repeater. The repeater custodian is my friend and I'm making it for him.

The define a "noise threshold" and treat any value below the threshold as equivalent to zero.

@Edgar Bonet I'm going to fine tune that once I get in touch with VU2ASH (one of the custodian). I'm making a protosketch.

I have to use the following protocol. https://docs.google.com/document/d/1-MHXkswdqyO2CX3Q_D83SsUi4Uosm34mRVtucOoSkCM/edit?usp=docslist_api

The following bare-minimum code will switch pin 13 to high after 20 seconds:
void setup() {
  // assuming pin 13 has a LED connected (as on most Arduino boards)
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW); // would also work without this line
}

void loop() {
  unsigned long time = millis();
  if (time >= 20000) {
    digitalWrite(13, HIGH);   // set the LED on
  }
}

Try if this works for you, i.e. if a LED connected to that pin will light up 20 seconds after reboot.
If not you will need to find the problem: Is your ATmega running at the correct speed? Is your code executed at all? Are the peripherals working?

millis() returns time in unsigned long format. Above code needs to be adjusted. (Otherwise its bound to create trouble) I'll try your code though. Pls try searching for alternatives!

Well, it would work for what it's written. But I've changed it to ulong.

Note that I don't suggest that you actually use code written like that for any other purpose than testing...


text:
Unable to connect to Linux Environment (Linino AR9331 Interface) in Arduino Yun
I was trying to reset my Arduino Yun (WLAN button pressed for more than 30 seconds), but it just kept on blinking for about 10 minutes. Then I finally got impatient and restarted the Yun. After the restart, there was no WLAN (blue) or USB (white) LED blinking or glowing anymore. I am unable to connect through the Wifi network, the Yun does not create it's own Wifi network and unfortunately when connected via Ethernet, I can still not navigate to arduino.local or 192.168.240.1.
So I have a feeling that somehow only the AVR is still functioning (because I can still upload sketches) and nothing else.
I have updated the firmware to the latest version (OpenWrt-Yun 1.5.3). Is there a way to connect or reset, if the Ethernet does not work? Can I upload a sketch to check in the console if the Linino interface still functions.
Thanks in advance!

As suggested in the correct answer, try to upload the YunSerialTerminal example and open the Serial Monitor to see what's wrong? And if nothing works, you can try http://arduino.cc/en/Tutorial/YunUBootReflash tutorial. But it's a bit tricky I suppose.

Try uploading YunSerialTerminal example, opening the serial monitor and pressing the YUN RST button. You should see the linux side starting.
If it starts but it looks somehow bricked, you could try following the http://arduino.cc/en/Tutorial/YunUBootReflash tutorial.

Hello! Thanks! So I was able to upload the YunSerialTerminal example and I did see the linux start up. But it just gets stuck at the following line: [   32.150000] Kernel panic - not syncing: Attempted to kill init!
I think I'll try to go for YunUBootReflash. I am not very sure how I can try to fix boot-up issues with the linux on the Arduino.

So, it works now! I did not go for a complete re-flash though. I had extended the Yun disk space before - http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace
But just removing the SD card made the linux boot up properly. I just formatted the SD card separately and put it back in. Everything seems to be in order. Thank you again!


text:
Concatenate two non constant char arrays in Arduino
I have two non constant char arrays. One is "buff" and other is "buffa". I get values in buffa via rf transmitter of other Arduino and I want to append those data to the data inside of buff. Then I will send all data to other Arduino. So I don't want to send two different char arrays. I want to send them all at once as just one array.
I TRIED SPRINTF BUT IT DOESNT WORK.
char buffa[144];
    char buff[1000];

void loop() {

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  sprintf(buff,"<status>\n");

    if (vw_get_message(buf, &buflen)) { // check to see if anything has been received
      int i;
      for (i = 0; i < buflen; i++) {
        buffa[i] = (char) buf[i];  // the received data is stored in buffer

      }
    }

  distance1 = getDistance(initPin1, echoPin1);
  sendData(3, distance1);

  sprintf(buff, "%s", buffa);

delay(5000);
 const char *msg0 = buff;

 vw_send((uint8_t *)msg0, strlen(msg0)); // Send control character
 vw_wait_tx();

 Serial.print(msg0);

}

Assuming the data in buffa is a c-style string (i.e. null-terminated), replace
sprintf(buff, "%s", buffa);

with
strcat( buff, buffa );


text:
Reading the audio signal from a smartphone
i want to read the audio signal from my smartphone.
Can i just cut a headphonewire and connect it to the analog in? (Arduino uno)
I sadly dont know much about electronics.
greetings

Similar existing question on EE: http://electronics.stackexchange.com/questions/28404/what-is-the-voltage-range-of-a-standard-headphone-jack-from-a-phone

My question is just, if sth bad can happen, when i directly connect the devices. I don't have the electronics for amplification and i don't need a stronger signal.

No. It partly depends on the phone, but most put out a low voltage AC signal. This would drive the Arduino inputs negative. You can do this by biassing the input at the mid point (+2.5V) and feeding audio in via a capacitor. There are many projects which use similar to record audio.
PS I would not recommend cutting a headphone cord. The wires are very fine, and almost impossible to solder. If you want to do this make a custom cable.

What do you mean with "This would drive the Arduino inputs negative"? (Sorry not native english)

@gorilla: signal transmission in electronic systems usually use voltage as the thing transporting the information. Usually the voltage is generated and measured relatively to a potential called ground, which often is also connected to casings and earthing facilities. AC signals which are always used to drive speakers reach negative voltages relatively to ground in (roughly) 50% of the time. The ardino has only inputs capable of measuring and detecting positive voltage levels. Milliways refers to the trickery needed to "convert" AC signals to readable signals on the arduino.


text:
Arduino Ultimate GPS Logger Issue
I am new to electronics and learning how to play around with arduino. I recently purchased the Arduino ultimate GPS Logger, and despite also buying an external anntenae the GPS data shows that it does not fix at all. Despite leaving the unit powered for more than 5 minutes. Please advise on what could be wrong. Is it normal to take so long to get a GPS fix? This is the Arduino in question. https://learn.adafruit.com/adafruit-ultimate-gps-logger-shield/overview

This style of antenna can be very finicky.  GPS on this module may take 15 or 30 minutes to lock, not just 5.  I would suggest you take this outside away from any walls or buildings and see if it will lock then.  I also suggest that you run it off a battery.  (one of those USB battery packs for charging your phone will work great).  Once you get a lock try changing one variable at a time (power supply / location) and see if you can get it to look again.
The reason this module takes longer to lock than your cellphone is that your cellphone is cheating by doing a warmstart.  The cellphone can get a semi-accurate time/date and also your regional location.  This warm start data improves GPS lock time down to 5 seconds or less sometimes.

Thanks. Is there a place where I can reference locations vis a vis GPS modules available and with high sensitivity for those locations?

If you want the best GPS signal, just go outside with a good wide view of the sky (no trees near or tall buildings)


text:
Debugging modified BlinkWithoutDelay
I have some level of programming background, however never with Arduino's. I've just started hacking at the examples - I'm not even sure what language I'm currently writing. I presume it's C++.
Anyway, I figured I'd try out the pin 13 LED with the BlinkWithoutDelay example. I've got that running fine (which I was very excited about), however I've tried to modify it to blink out SOS in Morse code, but it doesn't appear to be working.
// constants won't change. Used here to set a pin number :
const int ledPin =  13;      // the number of the LED pin

// Variables will change :
int ledState = LOW;             // ledState used to set the LED

// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0;        // will store last time LED was updated

// constants won't change :
//unsigned long interval = 1000;           // interval at which to blink (milliseconds)

// Number of times to blink
const long blinkMax = 10;
// Counter for number of times blinked
unsigned long blinkCount = 0;

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  int loopCount = 0;
  // S O S
  int values[] = {1000, 1000, 1000, 200, 200, 200, 1000, 1000, 100};
  blink(values[loopCount]);
  loopCount = loopCount + 1;
}

void blink(int interval)
{
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;
    digitalWrite(ledPin, ledState);
  }
}

As you can see, I've assigned the time values (1000 for long and 200 for short) to an array and had the loop function call my blink function each time. Every time it loops, it increments and goes to the next value.
I know it's able to pull values from the array fine, as I've tried manually modifying loopCount just before the blink() and it blinks at the specified timeout. I presume the loopCount increment is fine (I also did loopCount++; - no luck).
If someone could point me in the right direction, this would be great. Thanks!

Since it's blink without delay, the next loop will happen immediately. Not after the blink function is don't. So loopCount will increment continuously. You don't limit loopCount to 9, so it will after a few milliseconds try to access, e.g. values[12] which doesn't exist. (see @jfpoilpret's comment)
// constants won't change. Used here to set a pin number :
const int ledPin =  13;      // the number of the LED pin

// Variables will change :
int ledState = LOW;             // ledState used to set the LED

// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0;        // will store last time LED was updated
int blinkValues[] = {1000, 1000, 1000, 200, 200, 200, 1000, 1000, 100};
int loopCount = 0;

// constants won't change :
//unsigned long interval = 1000;           // interval at which to blink (milliseconds)

// Number of times to blink
const long blinkMax = 10;
// Counter for number of times blinked
unsigned long blinkCount = 0;

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  blink();
}

void blink()
{
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis >= blinkValues[loopCount]) {
    previousMillis = currentMillis;
    loopCount = (loopCount + 1) % 9;
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;
    digitalWrite(ledPin, ledState);
  }
}

Also note that the blink function will toggle the led, after the interval. So you need to add intervals, for how long the led should be off between flashes. But I leave that for you to figure out.

Your comment about loopCount is incorrect: it will never increment as it is a simple local variable inside loop().

You're right. I missed that one.