text:
What are the main differences between Arduino and mbed?
I have been working a lot with the Arduino platform over the last year. Arduino makes it very easy for beginners (in my opinion) to get started and has a large community and a lot of libraries for all kinds of peripherals.
Now, I am considering to have a look at mbed, too.
What are the main differences I would face, both practical and conceptually?

As both an Mbed user and an Arduino user, this is my perspective on the differences between the platforms.

The IDEs are completely different. The Mbed IDE is an in-browser compiler that allows you to easily import other people's source code. It is a full c/c++ IDE that saves your code to your online Mbed account. You must be signed in to do any development work (requires internet access). Code completion exists, but is clunky. Project format more closely mirrors c/c++ programming than does Arduino's environment.
Programming the board is different. The Mbed uses a custom boot loader. The Mbed shows up as a flash drive when you plug it into your computer via USB. You compile your code using the online IDE, download the .hex file, and copy it to the Mbed. It's actually pretty neat, but more time consuming than clicking the 'Upload' button in the Arduino IDE.
The Hardware is different. This means different pinouts, as well as different capabilities. Take a look at the Mbed platforms and compare them to the Arduinos. Mbeds are generally more powerful than Arduinos (cpu speed, mem size, build in capabilities).

I use my Mbed when my Arduino isn't powerful enough or fast enough. It would replace Arduinos for me if it wasn't for the online IDE. The IDE is a little awkward to use, and it takes too long to program the board (downloading/copying and pasting is much more inconvenient).
I'm able to use all my same sensors and peripherals that I purchased for the Arduino with my Mbed (Except for shields due to the physical layout differences). I sometimes have to rewrite code to get it to work on the Mbed, but that's a good learning exercise.

Nice answer. What about pricing? mbed seems to be a lot more expensive (maybe because there's no cheap Chinese clones). Is it possible to use a standard build chain instead of the online compiler?

@fuenfundachtzig I'd compare the mbed to the Arduino Due or Mega. In which case, it is more expensive by ~$10. Not too bad. I got my mbed for free by emailing the company and asking to be be 'sponsored' (I was using an mbed for my senior project).
Thats a good question about the standard tool chain. A quick google looks like it is possible ( http://developer.mbed.org/cookbook/Using-mbed-with-gcc-and-eclipse ). I'll have to give it a try

This seems to focus inplicitly on the original mbed board, but by the time you wrote this the focus had really shifted to supported a wide variety of ARM Cortex platforms from a number of vendors, many of them quite inexpensive and no small number accepting Arduino-sized shields.

@ChrisStratton so add another answer?

Just FYI, mbed has had offline support for many years. You can export your code to a variety of offline toolchains. Recently, mbed CLI was also released to compile programs offline without an IDE using GCC, ARMCC and IAR.

Mbed is so cool.The code is written everywhere that can get internet access. You doesn't like online IDE, you can get offline IDE such as Keil, GCC. You can get other kind of interface such as Matlab and LabView. Component and library is express together at main website. We can import lib: directly to workplace. If you have an idea, it is good to implement your idea quickly and best for prototyping.
I also like Arduino but I like mbed than Arduino.

There are a lot of good points here, but you could do a better job of stating them.

Please rephrase your text: Sentences like "The code is written everywhere that can get internet access" and "Component and library is express together  at main website" are totally incomprehensible.

You can run mbed offline. I do my development in VSCode using the mbed-cli to compile and pyopenOCD for debugging. The instructions on the website didn't seem to work out of the box on Windows. Wasn't too difficult to set-up, though.


text:
Burning a Uno bootloader into a Nano
I bought some cheap Arduino Nanos from ebay, but the watchdog does not work in them.
So I removed their old bootloader and burnt a new Nano bootloader from the Arduino IDE. Same problem, the watchdog didn't work.
Then, I burned a Uno bootloader to the Arduino Nano and now the watchdog works properly. The only issue here is that in Arduino IDE I now have to tell it that I am programming an Arduino Uno instead of a Nano. So far everything seems to work just fine.
Are there other problems that may arise from using a Uno bootloader in a Nano? I notice that there are some extra analog pins in Arduino Nano, but I will still be able to use them with the Arduino Uno bootloader right?

Assuming they're based on the more recent Arduino Nano 3.x series or later, the microcontroller in your Nanos is probably an ATmega328 running at 16 MHz. That's the same as the Uno, so there should be no major problems hopefully.
It might be worth checking that you've got the latest version of the Arduino IDE though. I seem to remember there was a problem in some older bootloaders which prevented the watchdog from working properly.

Yes I've got the latest version and I can confirm that the latest NANO bootloader still has issues with the watchdog.
Yes the uC are the same, NANO is SMD and UNO is not. The other thing that makes me brain scratch is the fact that UNO's analog pins go from 0 to 5 and NANO from 0 to 7. Which, being the same uC, makes no sense... Are UNO boards "ignoring" the two remaining analog pins?

The Nano is based on a 32-pin package version of the ATmega328, whereas the Uno is only based on a 28-pin version. One of the differences is that the 28-pin version has 2 fewer ADC channels. There's certainly a chance that compiling for Uno will mean you can't read the extra two analog channels via analogRead(), but I'm not sure. You could certainly access them directly though via low-level programming.

Incidentally, there is an SMD version of the Arduino Uno which uses the 32-pin package. However, it's designed to be directly equivalent to the functionality of the non-SMD Uno board, so the extra ADC pins on the uC are left unconnected.

A6 and A7 should work just fine when you select the Uno as target board. However A6 and A7 can only be used as analog inputs, not as digital-in or digital-outputs. To keeps things more consistent, and prevent noobs from miswiring things, I think it was a good idea to leave out those pins.

In boards.txt in the Uno section, you change one line for the pinout type from uno.standard to all_pins or something like that to make the analog inputs A6 & A7 available. Compare the standard Nano line against the Uno line and you can see the difference.  I can't access the Arduino files from here to say what they are specifically, sorry.
Ok, here we go:
Uno
uno.build.variant=standard
Nano
nano.build.variant=eightanaloginputs
So change the Uno line to
uno.build.variant=eightanaloginputs
Then you can bootlood the Nano board with Uno bootloader and should have A6, A7 available without issue.

This is not actually needed - while the "eightanaloginputs" option exists, the standard pins_arduino.h still defines constants for A6 and A7 even without it.

Really!  I'll have to try them sometime.  Thanks.

source: Stack Exchange

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

sort: votes


text:
Touch the Neopixels
I want to create a game using the individual LED "pixels" in a Neopixels 8x8 panel as a game pieces. Any ideas how I could add a touch event to each pixel?

Use a trellis.
Or put a resistive touch panel on top of the neopixels. You can connect those using 2 analog and 2 digital pins.

Trellis can only use single color LEDs. I will look into resistive touch panel.

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


text:
Do I need to worry about voltage, coming from ground, and effecting an analog input?
I am building a project that includes an analog Input and several digital Inputs and Outputs.  All of them connect to ground in some way.  Do I need to worry about voltage, coming from the digital outputs, going to ground, and effecting readings on the analog input?  If so, how do I deal with this?

If you have a different power supply powering the sensors than the arduino then you should connect all grounds so that they are common.  In other words the remote power supply and the arduino's power supple should have common bridged.

The arduino has build in pull up resistors, it is not a residue voltage coming from ground more than a "not 100% 0 volt" resistor.
Even though there is built in pull-up resistors one can add additional resistance to the arduino to make sure it will not show a false positive.
From what i have learned, you cannot experience voltage comming from ground (if everything is properly wired), if you want to make sure. Place a diod in the direction of the power flow, to prevent this.

In what cases would it not be wired correctly?

just to give an example out of many but reversed polarity. or 2 circuit where one might have less resistance.

In this case I do not believe ground bounce will be a problem. I normally only encounter it on high speed PCB designs. You will get noise from the power supply(s). Any impedance induced between the ground of analog input (circuit board ground) and the sensor will give you problems. Be sure all grounds are low impedance in nature. Since  you are designing the project consider and I assume a PCB, filtering the Aref pin supply with a small cap and a 100 ohm resistor. A low pass filter on all inputs will help, a small cap from the input pin to ground and feed it via a resistor. Good capacitors are very important.

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


text:
Using Arduino for Industrial process
I was wondering if the Arduino is applicable for Industrial monitoring, I want to make a real time status of the presses in our company. I haven't seen or read much about people using Arduino at an Industrial level, most of what I have seen or read are prototype projects.
I'm new in electronics and don't know if there is a better way of doing this rather than using Arduino. I was thinking of using Arduino Uno and Arduino Ethernet Shield or Wifi Shield.
Any help on some information on how to start on this is helpful.

Related post: http://electronics.stackexchange.com/questions/15535/reliability-of-the-arduino-platform-for-industrial-use/

I wouldn't use the Arduino in an industrial environment, as I wouldn't trust its PCB to be able to handle much noise. Use the Arduino and shields to prototype your application, and then move to a circuit board that uses proper techniques suited to an industrial environment.

From what a have read recently most suggest the same, I wanted to use the Arduino since I don't know how to build my own circuit board, but I guess Ill just have to learn thank you for the advice.

Any recommendations on a "circuit board that uses proper techniques suited to an industrial environment", or are you speaking generically that you should custom-design something and be sure to provide proper protections and isolation on all your inputs and outputs?

Protection and isolation is a start, but you also need to worry about things such as noise and vibration which can shake connectors loose, as well as chemicals and particulates in the air which can corrode or cause malfunction of the electronics.

Good points, hence why I recommended the soldering of the wires on any final product, rather than using jumpers. I just improved my answer below. I've seen professional boards that are 100% waterproofed too via clear-coat finishes. I wonder if you can just dip a whole, final, soldered board, such as a completed Nano project with all wires soldered, into polyurethane or lacquer to give it a protective finish against water, corrosion, humidity, chemicals, etc. You ever heard of doing such a thing?

Full conformal coating? Absolutely. It's not extremely common, but it is done.

I don't see any reason not to use Arduino in an industrial, engineering, or laboratory environment, if it meets your needs and does the job well. It is highly recommended, however, that you provide some sort of pin protection to keep industrial noise or voltage spikes from frying pins. Minimum pin protection could consist of using current-limiting resistors (or better yet, the other, more robust techniques shown here) on pins used for output and input signals. Optical isolation is also a good option, especially if potentially dangerous voltages are being used. Lastly, after you prototype and test your Arduino setup you should solder the wires to the Arduino and provide a protective case. You don't want to accidentally fry the Arduino or a pin via accidental static discharge (hence the case, and pin protection above), and you don't want jumper wires vibrating loose and connections slowly oxidizing over time and loosing electrical connectivity in any type of industrial or laboratory application that is expected to be used regularly (hence replacing your jumper wires with soldered wires). Shields, however, are prob. ok for low-humidity and room-temperature environments, as they are generally much more secure and solidly connected than individual jumper wires.
Note that you can solder wires to any Arduino, even the Uno, Leonardo, or Mega, for example, simply by soldering to the exposed portions of the pins on the bottom of the board. You can also cut off and desolder the female headers and either solder directly to the holes, or solder on male headers that you then solder to other PCBs. I especially like the Arduino Nano, Pro Mini, and Micro since they are small, have exposed holes or male pin headers, and can easily be soldered onto a professionally-manufactured circuit board or cheap protoboard, for better mounting in a final application. Keep reading below for more details on this.
I am an aerospace research engineer and use Arduino in my line of work regularly to solve problems. Here are some examples of current applications in use today, that I implemented, that are based on and using Arduino boards:

sensorless brushless motor RPM sensor, motor commander, and data acquisition device for bench-top testing
linear actuator closed-loop controller (linear stepping resolution is 0.01mm [10um], full moving range is 0 to 15mm); the Arduino commands the actuator driver board via a custom PWM signal using the Timer1 library (http://playground.arduino.cc/code/timer1); position is read via a custom quadrature encoder reader algorithm on the arduino; the actuator is used for very precise aiming of certain instruments; the $30 Arduino is taking the place of a $500 board that the actuator manufacturer makes, and the Arduino gives us much more functionality than the $500 board would give us. The Arduino and actuator will be used to precisely aim a laser for experiments in a wind tunnel.
flight controller interfaces between MATLAB and off-the-shelf Radio Control transmitter (read and write RC PWM & PPM communication signals)
Professional film studio communication interface on robotic, drivable camera system (info sheet & video).

Those are just a few cases. If it works, do it.  Once you prototype with a solderless breadboard, however, it is recommended that you at least hand-solder the final configuration to a permanent prototyping board, to make it more durable and noise-resistant (ie--primarily: so that it will have solid connections that can't corrode, break, come apart, or vibrate free easily).
Here's a soldering article I wrote (http://electricrcaircraftguy.blogspot.com/2014/08/recommended-soldering-kit.html#.VP-JCPzF-So). see the links at the bottom for recommended soldering tutorials. The one about how to make "solder tracks" was especially useful to me once I got past the breadboard stage and started prototyping things on double-sided perf board.
Here are some double-sided prototyping boards (or "perf boards") to look into once you get to this stage: (Ebay search for "double sided pcb") http://www.ebay.com/sch/i.html?_from=R40&ghostText=&_sacat=0&_nkw=double+sided+pcb&rt=nc&LH_BIN=1 -- get the ones with all the little holes in them. You can put the whole thing in a plastic case if you want too. You can permanently solder an Arduino (esp. the Nanos or Micros more easily) to one of these perf boards.
Here's another example of double-sized perf board. (image source: http://www.elecfreaks.com/store/doublesided-protoboard-8cm-x-12cm-p-410.html)

Professional PCBs:
If you need to make more than a few of some device, hand-soldering wires and pieces all over a perfboard can get to be VERY tedious. In this case, you need to design a more professional PCB with custom traces and pads and layout and all for your project. If you don't have PCB-designing skills yet with a professional tool like Eagle or KiCad, you can use Fritzing (http://fritzing.org/home/) to design a PCB, and then send it off to a company like OshPark (https://oshpark.com/) for high-quality, reasonably-priced, low-quantity US-based manufacturing---or send it off to the Fritzing Fab lab in Germany for high-quality PCB manufacturing that supports the Fritzing project. Lastly, for a couple really inexpensive Chinese options, look at ITEAD Studio and Seeedstudio. Fritzing and any other PCB CAD software tool can output the necessary Gerber files for manufacturing.
Quick tip: when designing a PCB, don't use any 90 deg corners for your traces. They can act as antennas (sending or receiving) and cause electromagnetic (including radio) interference and noise. Use multiple 45 deg edges and corners instead.
Once you get your boards back, solder your Arduino to them, and solder any extra parts or hardware to them you need as well. Now you have quite a professional product, even if it has an Arduino soldered right to it.
Summary:
In summary, yes I think Arduino is great. Without it, I wouldn't know how to even blink an LED or load a single code to a microcontroller, because getting into using microcontrollers was just to enigmatic, difficult, and complicated for someone not professionally trained in it, such as an Aeronautical engineer like myself.  With Arduino, however, I learned to build up my skills and solve real-world problems in professional environments.
I am very grateful to Massimo Banzi, David A. Mellis, and others who have made Arduino possible. It has changed my life and my ability to be useful in this life.  My favorite part about it is that even though it is a tool meant to get the non-programmer or lay-person to do basic stuff like blink a light using poorly-written blocking code, it has opened up my world beyond what I ever imagined before, and it is a fully-capable microcontroller that doesn't permanently hide away the low-level stuff. The low-level AVR functions, registers, etc are ALL STILL THERE AND ACCESSIBLE once you get to a level where you need them!
Cheers,
Gabriel Staples
PS: To see many of the very helpful links which I've referenced as I've built up my Arduino and ATmega328 microcontroller skillset, please see this article here, esp. all of the links at the bottom: http://electricrcaircraftguy.blogspot.com/2014/01/the-power-of-arduino.html

An option for very low volume is to print Kikad output onto purpose-built film (using a laser printer) then iron onto blank board. Works well for single sided; tricky for double sided.

Industruino just came out a couple days ago:

https://blog.arduino.cc/2015/09/21/industruino-makes-industrial-automation-easy-now-atheart/
https://industruino.com/page/home
https://www.youtube.com/watch?t=200&v=MhE1zlwsUu0
https://industruino.com/shop/product/industruino-ind-i-o-kit-2

Also:
1. Ruggeduino has much better pin protection than a standard Arduino.
One of the above may meet your need.
(No, I am not affiliated in any way with the above links; I just saw the Industruino the other day on the Arduino website and wanted to point out a couple other options).

If you're going to dump it in the field then I'd look at this one instead, since it has the isolation built-in.


text:
Arduino Sainsmart uno communication problem
I'm trying to communicate with my arduino uno but it seems to have troubles to understand characters. For example, printing things with Serial display weird things, changes characters, removes some.
For exemple printing "test !" every two seconds results in that :

Every characters have been removed except "!"...
Is my arduino broken ?  Thanks in advance

Use Serial.print() instead of Serial.write().

I started with Serial.print but when I noticed that it wasn't acted normally I used serial.write. But it is also acting weirdly with Serial.print()

Actually with Serial.print() it seems to be only displaying numbers... Serial.print("Test!"); output '8225'

You are doing 2 things wrong in your program:
First is using serial.write(), which writes bytes rather than ASCII.
Second is you are declaring a string literal as a char instead, you must declare a string using  double quotation marks (which is ") so that your program should read:
Serial.print("Test!");

When you declare 'Test !'  you are doing it wrong, and it will only take the last char in the string, which is '!' - using single quote marks is for a single char declaration, like '!' or 'T', and you can make an array of chars into a string if you wanted, like this:
char array[] = {'T', 'E', 'S', 'T', '!' };
Serial.write(array, 5);

but why would you when the earlier one works better?

The single vs. double quotation marks is a good catch. Serial.write("...") should still work though according to the documentation, as an ASCII string is just a sequence of bytes like any other.

@PeterR.Bloomfield indeed, however they are not formatted as ASCII human-readable bytes for proper use in the terminal viewer - the issue the OP had was junk bytes being displayed, or just '!' due to the compiler and it's string literal vs const char declaration behaviour

Serial.print("...") is literally just a wrapper for Serial.write("..."). They send exactly the same thing.

@PeterR.Bloomfield well it depends what you are sending, and to what - if you are doing serial to an external serial device you may not want ASCII conversion of your bytes, so Serial.write should be used. For nice terminal output, and lots of extra functionality of specifying the format of data in ASCII (such as the HEX formatter) using Serial.print() is better. The OP in his case should be using print, just for convenience sake. I've pointed out why it's not technically working, and indeed if he understands how both work then he CAN use both for reading terminal data.

It inevitably comes down to both ways using .write() but .print() has cool stuff, and for noobs I suggest they use it until they get better at programming.

Thanks a lot !! It was just the simple quote that was making it act like this !


text:
RSSI stop sketch on a gboard (atmega)
I have this function in my code and works fine (it returns a valid value, I put this value into a int variable outside function), but when end the function (or continue the code), my sketch stop/die...
///FUNCION PARA RSSI XBEE///
byte rss() {  ///PARA RSSI
union {byte B; char C;} atCmd[3];
AtCommandRequest atCmdReq;
AtCommandResponse atResp;
byte respLen, *resp, dBm;
strcpy(&atCmd[0].C, "DB");
atCmdReq = AtCommandRequest(&atCmd[0].B);
atResp = AtCommandResponse();
xbee.send(atCmdReq);
if (xbee.readPacket(5000)) {
   if (xbee.getResponse().getApiId() == AT_COMMAND_RESPONSE) {
       xbee.getResponse().getAtCommandResponse(atResp);
       if (atResp.isOk()) {
           respLen = atResp.getValueLength();
           if (respLen == 1) {
               resp = atResp.getValue();
               dBm = resp[0];
                  return dBm;
           }
           else {
             //  Serial.println("Unexpected response");
           }
       }
       else {
         //  Serial.println("ERROR");
       }
   }
   else {
     //  Serial.println("Unknown response");
   }
}
else {
 //  Serial.println("No response");
}
}///fin rss()

¿Any tips?

Your function is only returning a value when everything works OK. If an error occurs, the problem is reported to serial but it doesn't return anything. It seems likely that this could cause stack corruption which could make the program stop.
A simple solution would be to put return 0; (or some other number) just before the end of the function.

Thank you Peter, I try to end the function with "return 0", but doesn't work...

I need to erase the first "return" ?

@xavi No, you still need that return statement where it is. The additional return statement is to handle situations where the first one doesn't get executed. In C++, functions must execute a return statement unless their return type is void.

Wow! Nice explication! I try to make the function void, but still not working... thanks for four time! ...I can´t vote up (I have insuficient range), but +10 for you!

Yeah! Now I can vote up for you! Thanks, you rule!


text:
How to add Ultrasonic Sensor to the board?
I am making an RC car , have combined the Arduino UNO R3 with the AR 293d, and pluged in the HC-SR04 sensor to the SRO4 hole at the left top corner in the below graph. However, besides one sensor  I would like to add three more HC-SR04 sensor.
Reference:
http://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/

The problems are
1) is the board sufficient to plug three more sensor ?
2) or what extra board I need if not sufficient and how to combine those board
2) also, can I plug in other hole?
Thanks for helping
Update: breadboard connection
So I have to get a stuff like this?
http://www.tandyonline.co.uk/small-solderless-breadboard.html
and one more question, sorry for begin newbie, there are many holes on breadboard, which hole I should connect those three sensor on it, and the hold I should connect the breadboard with the AR-293D board?
And for programming, is there any way to get the pin at the breadboard as I have read some program before, the pin is assign with a number?
Thanks again for helping.

If you are in doubt on how to use breadboards and perfboards check out this video with collin: https://www.youtube.com/watch?v=w0c3t0fJhXU I would recomend watching everything he made - he is fairly entertaining and going in a steady pace where everyone can follow.

1) Not really. You have so little space and you have to selder them. Try using wires
2) If you want it to be flexible use a sandard solderless breadoard on the center of the car and then with male-female jumperwires try connecting them.
3) The board has traces. That means some holes have a very specific purpose.
Updated:
On every breadboard the holes are connected verticaly. For example, in the image from your breadboard you posted 1A, 1B, 1C, 1D and 1E are connected together.
If you would like to have all of the 3 sensors better use wires and then atach them on to your breadboard.
Here is a picture:
https://www.dropbox.com/s/3ij4w6eytio8p08/Screen%2016-25-31.png?dl=0

Thanks a lot, then I go for a breadboard, please have a look at update question.


text:
Serial Print, String And Variable On Same Line
How can I print to the serial monitor a string or just single character followed by a variable like "L 55"

Read the Arduino docs for Serial.print.

int Var = 55;
//Do it in 2 lines e.g.
Serial.print("L ");     // String
Serial.println(Var);    // Print Variable on same line then send a line feed

For debug printing, you can define a macro to print both the name and value of a variable like this:
#define PRINTLN(var) Serial.print(#var ": "); Serial.println(var)

which you then use like this:
int x = 5;
PRINTLN(x);

// Prints 'x: 5'

Also this is nice:
#define PRINT(var) Serial.print(#var ":\t"); Serial.print(var); Serial.print('\t')
#define PRINTLN(var) Serial.print(#var ":\t"); Serial.println(var)

when used in a loop like so
PRINT(x);
PRINT(y);
PRINTLN(z);

prints an output like this:
x:  3   y:  0.77    z:  2
x:  3   y:  0.80    z:  2
x:  3   y:  0.83    z:  2

Thanks a lot for your answers. I made this ...
#define DEBUG  //If you comment this line, the functions below are defined as blank lines.
#ifdef DEBUG    //Macros
  #define Say(var)    Serial.print(#var"\t")   //debug print, do not need to put text in between of double quotes
  #define SayLn(var)  Serial.println(#var)  //debug print with new line
  #define VSay(var)    Serial.print(#var " =\t"); Serial.print(var);Serial.print("\t")     //variable debug print
  #define VSayLn(var)  Serial.print(#var " =\t"); Serial.println(var)  //variable debug print with new line
#else
  #define Say(...)     //now defines a blank line
  #define SayLn(...)   //now defines a blank line
  #define VSay(...)     //now defines a blank line
  #define VSayLn(...)   //now defines a blank line
#endif

if (some_condition) VSayLn(some_var); won't work as intended. The standard fix is to #define VSayLn(var) do { Serial.print(#var " =\t"); Serial.println(var); } while (0). C.f. Why use apparently meaningless do-while and if-else statements in macros?


text:
ATMega328P-PU and 328P-AU
im planing to make my very own arduino design based on the Arduino PRO mini. I picked this board instead of the UNO mostly because it's way more simpler compared with the UNO since the USB-to-Serial part is missing. As many of you know the MINI uses the 328P-AU which is the SMD version of the 328P however since the AU version is too small for me i would like to use the PU (UNO's chip) instead. From the datasheets the only difference is a small change in the pins position. And the one million dollar question is: Is there any difference on those 2 chips? If i try to use the same design just with the PU model is it gonna work?

The -AU and -PU suffixes on the part name indicate different packages. The former is used for the "32A" package (32-lead TQFP), and the latter is used for the "28P3" package (28-lead DIP). In plain English, the -AU is a surface-mount part, and the -PU is a breadboard-friendly chip.
As far as functionality, there is virtually no difference. The 32A package exposes pins for ADC6 and ADC7, which are not available on the 28P3 package, but they are otherwise identical. (Note that these pins are only used for the ADCs; they are not a member of any port, and thus cannot be used for digital I/O.)

There's also an -MU which is QFN
surface mount.

There is no difference as far as Arduino is concerned. I think the AU has a couple extra pins (analog ins), that you might want to route to header locations in a surface mount design, but if your design is based on an Uno, them you can also just leave those pins disconnected with no impact.

I would go with the PU version because you can work on a breadboard with it for testing. If you are going to make a surface mount this to a PCB then use the AU. Regarding the actual difference forgetting about form factor, there is none.

You are wrong, the SMD version has two additional ADC inputs (ADC6 and ADC7).


text:
ModbusMaster.h - changing node
I'm using the ModbusMaster.h library on a project, with arduino-uno and a TTL/RS-485 converter, and the function has to identify the slave that it is communicating. The slaves goes from 1 to 16. After I've begun the connection,
ModbusMaster node(1);
node.begin(9600);

I have to send a message, and if this massage returns an error, I have to change the slave number, until I got an valid answer. But I didn't find any functions to close this connection, or to delete it, I even have tried,
delete &node;

but it didn't work. I'm trying to close this connection so I could begin another one with another node, because I didn't find a function to change the slave number.

I see no function to change the _u8MBSlave other that the constructor. My C isn't great by you might try something like node = ModbusMaster(2);

Generally speaking, you should never call delete on something unless you originally created it with new. Attempting to delete an object from the stack could cause your program to crash or misbehave in other ways.

Indeed that would not work. But why not ModbusMaster* node = new ModbusMaster(id), then send, check for error, if so delete *node, ++id, repeat? Not the most efficient, but simple. (You could also add a function to change the id to the library.)

Gerben, it didn't work, =/. Thanks for the tip Peter. Fuenfundachtzig, how do you pronunciate that? O.o, but it didn't work either. But to solve, I had to create a function that keep creating another nodes, and every time it made a new node, it'll send a request, and if the request was an error, it passes to create another node, if the answer was a success, it would made: ModbusMaster node4(4) "if the success was on the 4th try", then: node4.begin(); node = node4;

Maybe this question is too old and the API has changed, so my answer is reference.
The ModbusMaster constructor does not accept parameters.
From reading the source code, the method begin(uint8_t slave, Stream &serial) just initializes variables and can be called again with a new slave value without the need to destroy the ModbusMaster object.
Reference:
[1] https://github.com/4-20ma/ModbusMaster/blob/master/src/ModbusMaster.cpp, line 61.


text:
I want a couple of servos to listen for P.C. input (data from OSC protocol), can I bypass having to use an Arduino?
...and whack a stripped usb cable straight into a prototype board?
by bypass having to use an arduino I mean any kind of sheild? polulu would be perfect but im trying to avoid needing any of this.
My issue for finding tutorials and documentation on the subject is not quite knowing what keywords to search for, could someone point me in the right direction?

Can you be more clear about what servos you want to control with what kind of signals? are you asking about just a shield no arduino? just the servos, nothing else? BTW just a stripped USB cable wouldn't have the USB to serial adapter built into most arduinos.

USB is a non-trivial interface which involves fairly tricky signaling, so while you don't need an Arduino, you do need a USB-enabled I/O chip or microcontroller.  There are indeed examples of such quite a bit cheaper than either an Arduino board, or even just the critical components on it which enable this functionality.

yes thats it, the least amount of money needed to create signalling from usb with an outside powersource then? to be clear about hardware, I want to know if I can use output from computer programs nameley OSC so im not to bothered with details about servos specifically, just recieving data from dahn the usb cable

by OSC, you mean the Open Sound Control protocol right?

yeah, I understand it im controlling a program listening for osc and that program is sending commands based on the input to say, a prototype board or micro controller, as I understand it, dmx is appropriate protocol for robots but I just want cheap computer to robot interface

If I understand your question correctly you're asking if you can control servos with OSC and no microcontroller.
OSC is a protocol used for networking and communication between synthesizers, similar to midi in that, but totally different in the way OSC sends data which looks a bit like XML.
There's a couple of problems here:
1. Servos will not respond to OSC-signals. You could use MAX/MSP to generate servo-pulses from the OSC. The problem arises whan you are going to send this to the servos using usb.
2. USB, a fast data-transmission technology, is not suitable to be connected straight into a servomotor.
Arduino uses an atmega16u to transform the data from usb to serial (called a usb to serial programmer) for programming and communication. Then the microcontroller (atmega168/328) takes this and creates a pulse and a signal for the servo-motors.
To control servos without a micro-controller using USB is impossible.
It is be possible to control electronics using the serial-port and low-level coding. Used to do stuff like that on a Commodore 64 a time ago. Before these affordable, stable, reliable avr, arm and pic programming cards came out.
A tip: It is possible to load a program onto an atmega168/328 using a Arduino UNO or similar. Take the chip off of the programming card(ie. the Arduino UNO) and create a stripped down version, containing the micro-controller chip, 16kHz crystal, some capacitors and an usb to serial converter/ftdi-cable.
Regards
Krister Borge

I wouldn't say it's impossible as there are USB-connected PWM generators, but a MCU would certainly be the best way.

Ok, I see where you are going. It isn't impossible, just really hard. Most usb connected pwm generators has mhave mcus btw..

Arduino does not utilize an FPGA.  However, state-machine based logic such as is often implemented in a programmable gate array would be a way of controlling a servo (including a common PWM hobby one) from a USB host without utilizing a stored-program microcontroller.  This is generally not done, because sufficient slices of programmable logic cost more than microcontrollers, and in a commercial-scale environment (such as an ASIC) tend to be a less flexible, and therefore more expensive, method.  It is speculated that even most fixed-function USB interface bridges are MCUs inside.

Uhm, you're right, it doesn't, my bad. I fixed it.

Okay, understood. theres no point getting an arduino and pulling it apart so I will stick to traditional setup... Control a program with OSC on a PC and that PC will communicate with an arduino via USB and the Arduino program will turn that data into servo commands.

What would you recommend as the simplest way to control a pan tilt machine with OSC?

Attiny and some mosfets.

A build-your-own-duino isn't hard to do and it is quite inexpensive. It will make your life (or the part it you're about to spend creating custom hardware) much, much easier! I have built Joao Alves' CSE-duino for example and it has everything an UNO has except for:

on-board USB (use an FTDI cable that has USB <-> Serial in the cable head)
a 3.3v power supply; and
an ISP (high-voltage programming) connector;

, none of which you should need to drive a servo.


text:
Is it possible to connect many arduino uno in one pc?
We have many Arduinos and we will be putting each of them in a cubicle. All of them are connected to only one PC. The PC will stand as a server were you can control your Arduino there.

http://forum.arduino.cc/index.php?topic=407.0 Seems like it is possible, you just have to do more than just plug multiple Arduinos into the pc.

Slightly beyond trivial on a recent Linux, don't know about Windows or OSX.

Modern FTDI device driver should be fine, that forum post is from 2009. As long as each arduino gets a unique COM port number, I don't see why it wouldn't work.

If you can test the idea using two arduino, it should scale to any number (assuming there's no artificial restriction in the arduino IDE source code. The days of COM1/2/3/4 are long gone, they should be enumerating the port numbers from the OS instead of guessing.) Try it and see?

Yes, you can connect multiple Arduino UNO (USB) boards to a single PC. There's a simple way and a more advanced way to manage it.
The simple way is, having multiple boards plugged in, but using only one Arduino Software IDE to control one board at a time. (IDE = Integrated Development Environment. Some elements of the Arduino system use non-standard technical terms.) Use the Tools > Port menu to select which one of the attached boards to control. The selected board type and port appear in the lower right status bar.
A more advanced way to manage multiple boards, is to open multiple Arduino Software IDE instances -- each instance has its own independent Tools > Port setting. You could then edit, verify, and upload two different "sketches" (programs) to two different boards, without losing your place and without having to constantly change the Tools > Port setting. This would be convenient if you were developing a communications protocol between two or more boards.
This multiple-ports technique won't work unless you launch another instance of the Arduino Software IDE, without closing the first one. It isn't enough to use the File menu to open another window, because then you just get another window that shares the same Tools > Ports setting. Changing the ports setting on one window, changes the setting on all of the windows that belong to that instance. To support multiple boards at the same time, you have to actually launch the Arduino Software IDE again, without closing the first one, to create a second instance.
Usually you'd expect each window would represent a unique document, and they'd all be related to the application. But Arduino Software IDE has a hidden dependency between its windows. Whenever you restart the IDE, that opens a new and invisible instance of the IDE, where it remembers the board and port settings. If you use the File menu to open a new window, that new window is still part of the same IDE. So changing the Tools > Port setting on one window, changes that setting for all of the windows that belong to that instance of the IDE.
But if you restart the Arduino Software IDE (e.g. Windows Start Menu > Arduino-1.6.0), without closing the previously opened IDE, then you get a second instance. If you pay attention to the port setting visible on the lower right status bar of each window, you can distinguish which windows belong to which IDE instance.
Each time you launch the Arduino Software IDE, you start a new instance of the software, that can talk to one board. Each instance of the IDE can have an unlimited number of windows, but they all share the same Tools > Port setting. If you re-launch the Arduino Software IDE again without closing it first, then you get a second instance that can have a different Tools > Port setting, and thus control another board at the same time.
Verified on Windows 7, Arduino Software IDE 1.6.0, with two Arduino UNO revision R2 boards (firmware rev 0001), Arduino device driver 1.0.0.0.

How many instances of the IDE (and serial monitor) can one have running at once?

I don't think the OS places any artificial limit on the number of instances -- it's just like any other software as far as the computer is concerned. The installed hardware is what will limit how many useful instances you can open.

Note that the Arduino IDE is probably not the best way to communicate with the boards at runtime - at most it is a tool for development and test programming, but probably should not be used for a mass-rollout programming.  And it is almost certainly not what would be wanted for runtime communication - choose a solid standard or custom serial application for that instead.

@ChrisStratton and what serial application you think of?

I've run into the same question my self just on a Mac so in case anyone with Mac run into it: It is possible to connect and use many Arduinos to Mac at the same time. To do so run $ open -n /Applications/Arduino.app/ which will open a second instance of the Arduino IDE and you'll be able to select the Board and Port of each one and open multiple Serial windows. Notice that each Serial window has the path to the serial device which will help you know which window connected to which Arduino.

yes, you are only limited by the number of USB ports you have, however you have to consider is this is the best way to achieve what you are trying to do. You can get an ESP8266 device like the nodemcu, or something that gives you a wireless connection. With this, you can connect infinite number of devices to the central PC wirelessly. A Bluetooth module is also a good idea, it all depends on your budget and what you are trying to achieve.

I connect multiple arduinos to my  ubuntu system. I use text editor to write code and upload code and read output from terminal.
List arduino devices
$ ls /dev/ttyACM*
/dev/ttyACM0    /dev/ttyACM1

To upload code to arduino
# to arduino 1
$ arduino --port /dev/ttyACM0 --board arduino:avr:uno --upload bt/bt.ino

 # to arduino 2
$ arduino --port /dev/ttyACM1 --board arduino:avr:mega --upload bt/bt.ino

To check output
$ screen /dev/ttyACM1 115200

$ screen /dev/ttyACM0 9600


text:
For the digital output pins, how is LOW different than no connection?
I am working with relays and I noticed that connecting the trigger pin to ground (or a digital pin set to LOW) is not the same as having the trigger connected to anything.  For the digital output pins, how is LOW different than no connection?  Is there actually a current flowing into the LOW pin, or is there a tiny current flowing into the relay?
Is Ground and LOW the same voltage?

Connecting a relay directly to an output pin is not a good idea: you should use a transistor to provide enough current to the relay. You also need a diode to protect against reverse emf voltage.

I'm not sure exactly what you're asking but try giving this a read: http://arduino.cc/en/Tutorial/DigitalPins. What are you declaring the pin in question as?

(Edit for clarification: I've assumed in this answer that you're asking about the difference between connecting the relay to ground/LOW vs. connecting the relay to nothing at all. I've also assumed by the word "trigger" that your relay has some kind of digital actuation built-in, such as a transistor, or that it's simply a Solid State Relay.)
If something is unconnected, it is described as 'floating'. This means there could be random voltage spikes in it caused by nearby electromagnetic fields, making it appear to be switching on/off.
Connecting something to ground or LOW can stop this from happening by drawing away any induced currents.

What you describe is true for inputs, not outputs. The op is about outputs.

No. The electromagnetic environment does not create any currents on the floating pin. It creates voltage fluctuations.

@EdgarBonet Oops, sorry. I wrote this post late at night. :)

@jfpoilpret - I think we've understood the question in different ways. I've edited my answer to clarify my assumptions.

Ground and LOW are very, very close in voltage. They are the same when no current is being sunk into the output (LOW sinks current from higher voltages, HIGH sources current to lower voltages), but the voltage rises as the current does (the output has a resistance of about 25ohm).


text:
NodeJS (Galileo-IO) + Arduino sensor library
I've done some basic apps with NodeJS firmata where I can connect to my Arduino Uno and do the basics like reading a pin or doing a servo write. I'd like to go further and play with some different sensors from vendors like Adafruit.
Many such sensors appear to come with their own Arduino libraries. Using NodeJS firmata to communicate with my Uno, could I somehow use the sensor libraries? Maybe by including their header files in the Standard Firmata sketch before uploading or...? But then I don't know how I'd get at their methods from my NodeJS app.
Even better, I'd love a little direction on how to go about using an Arduino sensor library in a sketch, and use Galileo-IO to interact with the sensor that way, if possible.

Including the header files for the libraries in the standard Firmata
sketch is only the first step. You will have to also modify the sketch in
order to actually use the libraries. You will have to figure out a way
of interacting with the libraries through the Firmata protocol and
implement this in your modified version of the sketch. You will then
have to modify the JavaScript side to enable these new interactions.
That's where you will write the missing methods


text:
Arduino on ubuntu 14.4 gives "Broken pipe" and "Input/output error"
Im using arduino (R2) uno board and my pc is running 64bit ubuntu 14.4.
I was previously using arduino on ubuntu 10.04 for a long time and got no error. I recently moved to 14.4 from 10.4.
I installed arduino using this command
$ sudo apt-get update && sudo apt-get install arduino arduino-core

later arduino appeared, but was not working. According to this link, i was able to launch the IDE on mouse click. I then tried to upload servo examples, i get following errors.
Binary sketch size: 1,056 bytes (of a 32,256 byte maximum)
ioctl("TIOCMSET"): Broken pipe
ioctl("TIOCMGET"): Input/output error

I get the same error for even an Led blinking program too.
Update 1: (after Edgar's comment)
on terminal i get
~$ /usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Servo /tmp/build4933543797518254688.tmp/Sweep.cpp -o /tmp/build4933543797518254688.tmp/Sweep.cpp.o
avr-g++: error: /tmp/build4933543797518254688.tmp/Sweep.cpp: No such file or directory
avr-g++: fatal error: no input files
compilation terminated.

But on the IDE, after enabling verbos i get
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Servo /tmp/build4933543797518254688.tmp/Sweep.cpp -o /tmp/build4933543797518254688.tmp/Sweep.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Servo -I/usr/share/arduino/libraries/Servo/utility /usr/share/arduino/libraries/Servo/Servo.cpp -o /tmp/build4933543797518254688.tmp/Servo/Servo.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/wiring_analog.c -o /tmp/build4933543797518254688.tmp/wiring_analog.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/avr-libc/malloc.c -o /tmp/build4933543797518254688.tmp/malloc.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/avr-libc/realloc.c -o /tmp/build4933543797518254688.tmp/realloc.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/wiring_digital.c -o /tmp/build4933543797518254688.tmp/wiring_digital.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/wiring_pulse.c -o /tmp/build4933543797518254688.tmp/wiring_pulse.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/wiring.c -o /tmp/build4933543797518254688.tmp/wiring.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/wiring_shift.c -o /tmp/build4933543797518254688.tmp/wiring_shift.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/WInterrupts.c -o /tmp/build4933543797518254688.tmp/WInterrupts.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/Stream.cpp -o /tmp/build4933543797518254688.tmp/Stream.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/HID.cpp -o /tmp/build4933543797518254688.tmp/HID.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/Print.cpp -o /tmp/build4933543797518254688.tmp/Print.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/WMath.cpp -o /tmp/build4933543797518254688.tmp/WMath.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/CDC.cpp -o /tmp/build4933543797518254688.tmp/CDC.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/new.cpp -o /tmp/build4933543797518254688.tmp/new.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp -o /tmp/build4933543797518254688.tmp/HardwareSerial.cpp.o
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp: In function ‘void store_char(unsigned char, ring_buffer*)’:
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:100:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (i != buffer->tail) {
                    ^
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp: In function ‘void __vector_18()’:
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:129:21: warning: unused variable ‘c’ [-Wunused-variable]
       unsigned char c = UDR0;
                     ^
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp: In member function ‘void HardwareSerial::begin(long unsigned int, byte)’:
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:370:11: warning: unused variable ‘current_config’ [-Wunused-variable]
   uint8_t current_config;
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp: In member function ‘virtual size_t HardwareSerial::write(uint8_t)’:
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:469:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (i == _tx_buffer->tail)
                           ^
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp -o /tmp/build4933543797518254688.tmp/main.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/Tone.cpp -o /tmp/build4933543797518254688.tmp/Tone.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/IPAddress.cpp -o /tmp/build4933543797518254688.tmp/IPAddress.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/USBCore.cpp -o /tmp/build4933543797518254688.tmp/USBCore.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /usr/share/arduino/hardware/arduino/cores/arduino/WString.cpp -o /tmp/build4933543797518254688.tmp/WString.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/wiring_analog.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/malloc.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/realloc.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/wiring_digital.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/wiring_pulse.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/wiring.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/wiring_shift.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/WInterrupts.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/Stream.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/HID.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/Print.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/WMath.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/CDC.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/new.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/HardwareSerial.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/main.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/Tone.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/IPAddress.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/USBCore.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4933543797518254688.tmp/core.a /tmp/build4933543797518254688.tmp/WString.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build4933543797518254688.tmp/Sweep.cpp.elf /tmp/build4933543797518254688.tmp/Sweep.cpp.o /tmp/build4933543797518254688.tmp/Servo/Servo.cpp.o /tmp/build4933543797518254688.tmp/core.a -L/tmp/build4933543797518254688.tmp -lm
/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/build4933543797518254688.tmp/Sweep.cpp.elf /tmp/build4933543797518254688.tmp/Sweep.cpp.eep
/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom /tmp/build4933543797518254688.tmp/Sweep.cpp.elf /tmp/build4933543797518254688.tmp/Sweep.cpp.hex
Binary sketch size: 2,554 bytes (of a 32,256 byte maximum)
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/build4933543797518254688.tmp/Sweep.cpp.hex:i

avrdude: Version 6.0.1, compiled on Oct 21 2013 at 15:55:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/username/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "/dev/ttyACM0": No such file or directory
ioctl("TIOCMGET"): Inappropriate ioctl for device

avrdude done.  Thank you.

Update 2: (tried again, this time i get "broken pipe". Led 13 blinks like crazy and my servo sounds different, no movement but continues sound)
.
.
.
avrdude: avr_read(): skipping page 253: no interesting data
avrdude: avr_read(): skipping page 254: no interesting data
avrdude: avr_read(): skipping page 255: no interesting data
avrdude: verifying ...
avrdude: 2554 bytes of flash verified
avrdude: Send: Q [51]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

avrdude done.  Thank you.

/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Servo /tmp/build4258280580047414287.tmp/Sweep.cpp -o /tmp/build4258280580047414287.tmp/Sweep.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/Servo/Servo.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/wiring_analog.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/malloc.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/realloc.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/wiring_digital.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/wiring_pulse.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/wiring.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/wiring_shift.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/WInterrupts.c.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/Stream.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/HID.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/Print.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/WMath.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/CDC.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/new.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/HardwareSerial.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/main.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/Tone.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/IPAddress.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/USBCore.cpp.o
  Using previously compiled: /tmp/build4258280580047414287.tmp/WString.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/wiring_analog.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/malloc.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/realloc.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/wiring_digital.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/wiring_pulse.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/wiring.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/wiring_shift.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/WInterrupts.c.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/Stream.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/HID.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/Print.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/WMath.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/CDC.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/new.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/HardwareSerial.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/main.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/Tone.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/IPAddress.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/USBCore.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build4258280580047414287.tmp/core.a /tmp/build4258280580047414287.tmp/WString.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build4258280580047414287.tmp/Sweep.cpp.elf /tmp/build4258280580047414287.tmp/Sweep.cpp.o /tmp/build4258280580047414287.tmp/Servo/Servo.cpp.o /tmp/build4258280580047414287.tmp/core.a -L/tmp/build4258280580047414287.tmp -lm
/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/build4258280580047414287.tmp/Sweep.cpp.elf /tmp/build4258280580047414287.tmp/Sweep.cpp.eep
/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom /tmp/build4258280580047414287.tmp/Sweep.cpp.elf /tmp/build4258280580047414287.tmp/Sweep.cpp.hex
Binary sketch size: 2,554 bytes (of a 32,256 byte maximum)
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/build4258280580047414287.tmp/Sweep.cpp.hex:i

avrdude: Version 6.0.1, compiled on Oct 21 2013 at 15:55:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/username/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
ioctl("TIOCMSET"): Broken pipe
ioctl("TIOCMGET"): Input/output error

Check File → Preferences → Show verbose output during upload, 2. try again, 3. copy and paste the avrdude command line in a terminal and hit Enter, 4. post here all the output.

You have a communication problem.  The recommendation to try compilation commands from the terminal is not helping you, but merely showing that the files in /tmp are emphemeral.  Look into things like a flaky USB cable (or possibly an OS USB stack incompatible with quirks of your motherboard) which may be causing your board to "jump" to a different virtual port.  Check dmesg right after the failure.

@ChrisStratton - I uploaded example code form arduino IDE. And regarding brltty i removed it using sudo apt-get remove brltty. or is there any other steps involved with brltty

@ChrisStratton - I think your point is correct, about changing the cable worked. But that too worked only for certain uploads. During some upload i get the very same Broken pipe and Input/output error. Dose this issue has to do anything with improper installation. Because, when i get that error, my Icon never works on clicking unless i restart whole system, or i have to remove the cable and kill the avrdude process through sudo top command and then initiate IDE by sudo arduino from terminal. only then i get serial port active and displayed

Does the file /dev/ttyACM0 appear when you plug the Arduino and disappear when you unplug it?

@EdgarBonet - yes it dose. But while uploading the code, if i get the broken pipe error, it never appears until i restart the system or the arduino with some pkill or top command

You should never be running arduino (or any other IDE) under sudo.  If you think you need to do so, it is either because you have not given your account membership in the group which owns serial devices, or you have left behind files by running it as root in the past, which now only root can cleanup/replace.

If your /dev/ttyACM0 has failed for some reason while in use, a reconnection would probably show as /dev/ttyACM1 and so on, incrementing number.

@ChrisStratton - I tried sudo chmod a+rw /dev/ttyACM0 and then sudo gpasswd -a _username_ dialout also tried sudo usermod -a -G dialout _username_ as suggested from various tutorials. All i can start the IDE is only using the sudo command. Are those the right way to add account membership ?
and about the ttyACM0 and ttyACM1 i do get those some times and i understood that part, thanks.

Please try using the last IDE version released here: http://arduino.cc/en/Main/Software The version 1.6.1 has many improvements about serial devices detection and sketches upload.

What the right group is depends on your installation.  "All i can start the IDE is only using the sudo command" has nothing to do with port permissions (you would only have a problem trying to download or open the serial monitor), but only with a broken install, possibly as a result of having made a mess by improperly running it as root in the past.

@lcipriani - I downloaded v1.6.1. It worked fine without any error. But after downloading im only able to open it from the directory where it resides. can you please help on how to open it from anywhere..?

@arvindh it would be nice if you can upvote my comment if it really helped you.

@lcipriani - i Know, I tried, and im sorry that i dont have enough reputation points to upvote your comment. Please write up the solution as an answer, i will remove my answer and mark yours as accepted,.. Im glad to do that instead of taking credit of others effort. Please feel free to write an answer.

Please use the last IDE version released here: arduino.cc/en/Main/Software The version 1.6.1 has many improvements about serial devices detection and sketches upload. It will solve your issues about older Arduino UNO version and Arduino Yun.


text:
Arduino Uno with CC3000 WiFi Shield cannot be initialized
I am working on an Arduino Uno and CC3000 WiFi shield. I interfaced it over my Arduino and added the SparkFun library SFE_CC3000_Library. Then I opened the TestBoard example, but it hangs on setup in the first command wifi.init().
How can I solve this problem, and how can I enable debug mode?
Here's the code
#include <SPI.h>
#include <SFE_CC3000.h>
#include <utility/netapp.h>

#define DEBUG     1
// Pins
#define CC3000_INT      2   // Needs to be an interrupt pin (D2/D3)
#define CC3000_EN       7   // Can be any digital pin
#define CC3000_CS       10  // Preferred is pin 10 on Uno

// Constants
#define FW_VER_LEN      2   // Length of firmware version in bytes
#define MAC_ADDR_LEN    6   // Length of MAC address in bytes

// Global Variables
SFE_CC3000 wifi = SFE_CC3000(CC3000_INT, CC3000_EN, CC3000_CS);

void setup() {

  int i;
  unsigned char fw_ver[FW_VER_LEN];
  unsigned char mac_addr[MAC_ADDR_LEN];

  // Initialize Serial port
  Serial.begin(115200);
  Serial.println();
  Serial.println("----------------------------");
  Serial.println("SparkFun CC3000 - Board Test");
  Serial.println("----------------------------");

  // Initialize CC3000 (configure SPI communications)
  if ( wifi.init() ) {
    digitalWrite(13, HIGH);
    Serial.println("CC3000 initialization complete");
  } else {
    Serial.println("Something went wrong during CC3000 init!");
  }

  // Read and display CC3000 firmware version
  if ( wifi.getFirmwareVersion(fw_ver) ) {
    Serial.print("Firmware version: ");
    Serial.print(fw_ver[0], DEC);
    Serial.print(".");
    Serial.print(fw_ver[1], DEC);
    Serial.println();
  } else {
    Serial.println("Could not read firmware version from CC3000");
  }

  // Read and display CC3000 MAC address
  if ( wifi.getMacAddress(mac_addr) ) {
    Serial.print("MAC address: ");
    for ( i = 0; i < MAC_ADDR_LEN; i++ ) {
      if ( mac_addr[i] < 0x10 ) {
        Serial.print("0");
      }
      Serial.print(mac_addr[i], HEX);
      if ( i < MAC_ADDR_LEN - 1 ) {
        Serial.print(":");
      }
    }
    Serial.println();
  } else {
    Serial.println("Could not read MAC address from CC3000");
  }

  // Done!
  Serial.println("Finished board test");

}

void loop() {

  // Do nothing
  delay(1000);
  Serial.println("Loop_Problem");

    }

Solved it, the problem was because the SparkFun library was not working with my shield. I replaced it using the Adafruit_CC3000_Library and now it works fine.

I was having the same problem with the ethernet shield (and i still have it). In my case it was caused by the network router. When my modem/router couldn't connect to the net (bad weather etc...) the shield couldn't take an IP and the initialaization was failing every time just because i was disconnected from the internet. The library works almost the same way. Basicaly you have to make sure it can connect.

Thanks for sharing solution with me. I solved it using another library. Solution is shared above.


text:
Adding HC-SR04 ultrasonic sensor to the board
I would like to add three more HC-SR04 sensor
Currently I have combined the Arduino UNO R3 with the AR 293d(refer to below graph), and pluged in one HC-SR04 sensor to the SRO4 hole at the left top corner. So I need to find the holes for t3 more sensor.

I have done some research already , for the connection , found more document
HC-SR04 Arduino
Vcc     +5V
Trig    GPIO
Echo    GPIO
GND     GND

The questions are ,
1) From the above graph, is that mean I can only add two more sensor to the board , since there are only 2 more 5V, GND , 12 , 13 pins (at the top and bottom holes)
2) How can I connect them separately ? That means, what I need to connect from sensor to the board?
3) If I need other board eg. breadboard to connect them, How should I connect sensor to breadboard and how can I connect it with the main board(AR 293d)?
Thanks a lot for helping. Any answer is useful for me

Welcome to Arduino SE! Can you please clarify how this question is different than the linked question in the comment above? Thanks!

Only pin12, trig needs to be unique. You can only work with one US at a time, all the echo pins can be combined to one. So for 3 sensors, you will need 4 pins, plus vcc/gnd

This question is about using multiple Ultra sonics. the linked to question about generic breadboarding.


text:
Pair of nRF24L01s ping/pong example sketch works, but using my own code fails after first successful transmit
I have a pair of nRF24L01s connected to a pair of Arduino Unos and I'm using the RF24 library from here: RF24 library. When I run the pingpair example sketch, the radios transmit and receive back and forth just fine. So I tried to program my own very simple example but I'm running into a problem where the first message transmits successfully (and is received successfully), however, subsequent messages fail to send. The call to radio.write() returns false.
I'm using the following code on the 'sender':
RF24 radio(9,10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
uint8_t payload[1];

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setRetries(15, 15);
  radio.setPayloadSize(1);
  radio.openWritingPipe(pipes[0]);
}

void loop() {
  payload[0] = 1;
  bool ok = radio.write(payload, 1);
  Serial.println("Status: " + (String) ok);
  delay(200);
}

And the following on the 'receiver':
RF24 radio(9,10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
uint8_t payload[1];

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setRetries(15, 15);
  radio.setPayloadSize(1);
  radio.openReadingPipe(1, pipes[0]);
  radio.startListening();
  Serial.println("Listening: " );
}

void loop() {
  if (radio.available()) {
    bool done = false;
    while (!done) {
      done = radio.read(payload, 1);
      Serial.println("Got payload: " + (String) payload[0]);
    }
  }
}

I'm guessing the problem has to be with my code because the example sketches work, but I can't figure out what the problem is. Again to summarize, when I reset the Arduino, the first call to radio.write() returns true and the message is transmitted. After that, subsequent calls to radio.write() return false.
Also note that I did try adding a 10uF capacitor across +3.3V and Ground but it did not help.
Thanks for any help.

Do you need to reset both arduinos to make it work or just one?

Which library are you using?

I agree with the answer below to use several Serial.println to figure out where it gets stuck. In the library config file (RF24_config.h) there is a #undefine at line 32 - change that to #define so you get the serial debug strings from the library as well so you can try to figure out where the error is happening. If you still can't figure it out then post the debug output here.

What version of the library are you using? Please make sure you are using the maintained fork by TMRh20. http://tmrh20.github.io/RF24/

Comparing your rx against the example, i would suggest not having the while done statement. You could also throw in a few serial.write debug lines in both sketches, to log different parts of the code, to find where its getting stuck.

I was just having this issue. You need to be able to read and write on both ends. You send up sending an ack package back to the sending arduino like in the test sketch.
You ripped that part out.
You need to read back through the example code and line by line understand what the data is doing and why it's doing it that way before you can start using rf24.
The short of it is that the sender will send data and then finish and wait for a response packet before sending the next one. The reciever works much the same way except it always will be listening for incoming data until the sender message ends. Then it in turn will send a reply packet saying that it recieved the first packet.
Make sure that the reciever isn't looping waiting for packets. It should only respond once it recieves something. The sender should have a timeout on it so that it knows that it's messages are failing. This is also incredibly important for debugging so you can see who failed and why.
This is basically tcp at work.
You can also use noack and that's called udp

You should open a reading pipe on the transmitter end because when the reader receives your message it will reply with an acknowledge packet, which is expected by the writer in order to confirm the packet has been delivered. With your current setup, your writer is sending out a packet and expecting to receive the response on an address which is by default configured as a broadcast address.
On the sender side, you also need to start listening after sending the packet and stop listening before sending the new packet.
The transmission protocol works like this:

the sender sends a packet in the air and starts waiting for the ack
all listeners receive the packet, no matter their receive address
each listener check if the sender address matches with any configured reading pipe address

if the address matches then the listener sends back an acknowledge packet to inform the transmission has been accomplished
if the address does not match it discards the packet

if the sender receives at least one acknowledge packet then it marks the packet as being sent successfully
if the sender doesn't receive the ack packet within the configured time to live then sends the packet again until the retry count has not been reached
if the retry count has been reached then it marks the transmission as failed

So change your sender setup() and loop() functions above with:
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setRetries(15, 15);
  radio.setPayloadSize(1);
  radio.openWritingPipe(pipes[0]);
  radio.openReadingPipe(1, pipes[1]); // add this
}

void loop() {
  radio.stopListening(); // add this
  payload[0] = 1;
  bool ok = radio.write(payload, 1);
  radio.startListening(); // add this
  Serial.println("Status: " + (String) ok);
  delay(200);
}

You might also want to set the writing address on the receiver if you plan to use more than 2 radios, otherwise, you will not be able to distinguish who has acknowledged different packets:
radio.openWritingPipe(pipes[1]); // add this to receiver `setup()`


text:
Powering USB device from arduino uno?
I'm wanting to power a USB device from an Arduino Uno. Forgetting about the two data pins, it just requires power. Using a power meter, I can detect the 5v pin at about 4.95 volts, however I don't have access to any resistors at the moment so cannot test the amperage because it just shorts.
The USB device I want to power requires ~300mA (can't remember specifically). First of all, does the Arduino get 100mA or 500mA when getting power from the USB? Is this changeable depending on the setting on the USB Host (High 500mA, or Low 100mA)?
Secondly, how much would actually be usable? I assume the Arduino itself would require some of that current? Even more if a program where running on it at the same time? (I have no idea how computers utilize power) I would like to just hook up my usb device to ground and 5V with whatever resistors (and any other electrical components) in between to bring it down from 500mA to the required ~300mA.

If your Uno has access to a USB port for its own power then why not just use another USB port for the other USB device?

The Arduino receives 500mA max from USB power.  That is per the USB specification, and the Arduino has a 500mA resettable fuse on the USB power to protect your computer's USB port from 'accidents'.
As to the question of whether it is configurable between 500mA/100mA, generally no it's not. I believe that part of the USB negotiation that occurs when the Arduino connects to your PC is that the Arduino describes itself to the computer, and it reports that it is a 500mA device. Bottom line is, you won't need to do anything special in this regard.
Now, how much of the power is needed for the Arduino, and how much is left over - well that depends on what else the Arduino is doing and what else it's powering (LEDs, etc.). If the Arduino is not doing much else, than 200mA should be plenty of headroom for it.
If you power the Arduino through the PWR Jack (or the Vin), then the voltage should be a minimum of 7V. That is because it is feeding into a 5v regulator, which has some voltage drop, so it needs about 7V to be able to consistently supply 5V output.  If you power the Arduino manually (through the 5V pin), you want to give it 5V. Anything less than 5V would be considered overclocking. (The ATMEGA328P needs 5V to operate at 16mHz, but can run at lower voltages when clocked at lower speeds.)
Also, keep in mind that the USB port on the Arduino is a USB 'client', not a USB host or USB OTG. Therefore, the port can not be used to supply outbound power. You can power your extra device from the Arduino's 5V and GND pins.

The only AC/DC adapter I can find that matches is a switchable 6V/9V/12V with just under 1000mA. However it outputs via a negative and positive wire. So inputting directly to the vin pin is the same as inputting DC through the power jack? I would just need to connect positive DC output to vin and negative to any ground on the arduino, and that would give me a regulated 5V output on the 5V pin?

That's correct. The Vin pin and the PWR jack both feed into the power regulator. You can connect the positive DC output to Vin, and the negative output to any GND. Set the adapter to 9V.
The only thing the PWR jack has that the Vin does not, is a power diode that protects against incorrect polarity (the + and - reversed).  The Vin does not have that protection, so just don't hook it up backwards.

You'd have to test this but there's a chance you could supply the Arduino using a DC power supply on it's 5V pin. In this case DO NOT TURN YPUR SUPPLY HIGHER THAN 5V, as I don't believe there is any protection and will send the full voltage to the USB.
A safer option would be the Vin pin. Normally you'd want to put 7-12 Volts to this pin but you may want to start at 5V and work your way up just to be safe.
Someone please corrects if I am wrong, but if you never apply more than an external 5V your worst case scenario would be burning out the Arduino but not the USB device.

Please correct me if I'm wrong: The vin pin gets its power from the external DC jack at whatever voltage is supplied, and so can the 5V (limiting voltage to 5) and they both share the available current from the DC input? Could you explain why using the vin pin is safer? Wouldn't it be fine to use the 5V since I am powering a USB 5V device?
Also, I assume grounding a circuit on the arduino using a custom volt and/or amps DC power source may well damage the board? You stated max of 7-12Vs, any idea of what sort of max amps?

The Vin pin is the input for external DC voltage, whereas the 5V pin is regulated as a 5V output for powering other equipment.  For this reason using the Vin pin is safer because it regulates the outputs (including the 5V pin) to a constant 5V.  If say 6 or 7 volts were applied to the 5V pin, you may damage the Arduino or draw unnecessary current from your power supply.
I suggested 7-12V on Vin because this is the safe range specified by Arduino and will turn on the onboard voltage regulator. Turn the current to a max on the power supply, the actual current drawn is regulated by the Arduino

As far as current limits I believe they are 500 mA for the 5V pin and 50 mA on each of the signal output pins.  In regards to your original question, have you tried connecting ~9V DC to the Vin pin and testing for 5V on the USB port? I still believe this is your best option if it works.


text:
which is the most efficient way to save power with battery using Arduino UNO?
I am working with a ArduinoUNO - 2100 mA battery, and a solar Charger shield. I use a temperature reader that sends info every half hour with GPS-GSM shield called LONET (http://www.seeedstudio.com/wiki/LoNet_-_GSM/GPRS/GPS_Breakout for more info).
I want to save all the energy i can, i am trying to put Arduino UNO and LONET on Sleep mode.
LONE has its own mode via “AT+CSCLK=1”.
But for Arduino UNO i haven seen a library called Narcoleptic (https://code.google.com/p/narcoleptic/ for more info) wich can solve the problem.
My question is:
Is there any other method that can help me to save Battery with Arduino uno? is it a good approach to use Narcoleptic or there is another method to do it?
Thanks for your time/help and sorry for my English.
Any feedback could be welcome.

The uno board isn't very power efficient. There is the USB-to-serial chip that doesn't sleep. And the voltage regulator (I've heard) isn't very efficient. Sleeping the ATMega doesn't really help a lot. Better go with something like a Arduino Mini, and use an external programmer.

Thanks you for the answer, i will try to search info about Arduino Mini.

The regulator is horribly inefficient, especially when paired with the power steering circuitry in the Uno.

There is an even greater article on this topic: http://www.gammon.com.au/power
It shows how to reduce your power usage for the Uno from about 50mA to 350nA (0.000350mA) - at this point, you need to factor in the natural drain of batteries.
Also, I have had good success with a project that was activated by a pushbutton, by using a latch - the push button turned the power on; once the power is on, it latched. Then the Arduino can switch itself off, using one of it's pins. As far as I can tell from a simulator, there is no leakage (while it is off, to within the accuracy of the simulator, assuming a perfectly spherical transistor in a vacuum ;) ).
Just in case anyone is interested, my latch circuit can be seen at: https://i.stack.imgur.com/Uf9sX.png - the two resistors and the switch at the bottom represent the Arduino - +5V coming in the top, GND at the bottom, and one of the pin to switch it off is the switch - this pin should be INPUT to keep the power on; when you are ready to switch of, set it to output -> high. You should get switched off immediately. The switch at the top will switch it on. In the startup part of your sketch, set the pin to INPUT first.

There's a great article on that topic: https://www.openhomeautomation.net/arduino-battery/


text:
Connecting hardware to the Arduino
I'm using an Arduino Due with various sensors. At the moment, I'm using the majority of the pins along the width (the double width pins). I want to make the setup more permanent, however I can't seem to find any ribbon cables with 36-conductors. What do you use for long term connections on the Due, especially if you occasionally need to unplug all the connections? Would a 40-pin ribbon cable work as they're easy to come by.
Thanks

I have used 40 pin cables for this purpose, specifically, IDE cables (beware: on high speed, "80 conductor" cables, but still with 40 pin connectors, some pins are permanently connected, to indicate to to the controller that this is a high speed cable!). The connectors are cheap, the cables are free if you ask around (probably less so now). In my case, I connected two extra-large 7-segment displays, and it worked great. More pins than you rarely hurts. In my case, it was especially useful since I needed some pins at the top, and some pins at the bottom of the display; my ide cable had three connectors (motherboard & two drives); I used the top row on one ide connector to the top of of my displays, and the bottom row of pins on the other connector to the bottom of the displays.

You can also make your own IDC ribbon cables pretty easily. A 36-pin cable might be pretty hard to find a connector for, but you could use a 20-pin and a 16-pin side by side.
Have a look at Kobicon 164-9008-E and Kobicon 164-9001-E.
You can get creative and mix and match different pin counts, depending on your project. Buy a few meters of 40-conductor .05" pitch ribbon cable, and you can peel off the 4 outermost conductors to make it 36-conductor, as well as separating the end of the cable into your connector groups.

Take a look at these jumper wires. http://www.amazon.com/gp/aw/d/B00M5WLZDW/ref=mp_s_a_1_6?qid=1431346007&sr=8-6&pi=AC_SX110_SY165_QL70 they are really great for debugging as well as more permanent solutions.
If you are looking to build more than 5 go with some of the other posted answers


text:
Can I use an Arduino and GSM breakout board for triangulation?
IS there a way for me to use cell towers to triangulate my location with an Arduino Uno and GSM breakout board? if so how?

What sort of accuracy are you after? If you're thinking within a set group , then no as the signal is too variable; if you're thinking in square miles + then yes! Just walking through the 'shadow' of a building will cause major signal level fluctuations.

A directional antenna with "steering" will be of some value in some situations, but 'city canyons' may render this useless (or worse :-) ).

While there are obviously limitations, the key question is if your module exposes cell identity and signal level information via an interface you can use.  And it would seem more useful if it can expose info for additional cells it is aware of, beyond the one it is actually using and when not engaged in handover.

what if i used a gps module? How accurate could I be?

new gps modules are really good, but the accuracy depends on many variables. number of satelites, weather. worst case can be kilometres, best case can be less than 1 meter... But if you have the choice go for gps. It does what excactly what you want...