text:
HDMI EDID emulator
I am working on a project where i emulate the EDID of a screen to force a source into sending data on a certain resolution.
I read the original EDID code of a screen and change the timings into the resolution I want to force the source in, i send this changed EDID code to the source with an Arduino uno when the source gives a read on address 0x50 (where the EDID located, see handshake). We have an HDMI in/out with the data lines connected thru and the DDC lines (source) connected to the Arduino that we can send the changed EDID to the source (i²c protocol).
I can change the resolution successfully on some sources, and on some it doesn’t change. The attached screen doesn’t find a source. I use the same code for both scenarios.
#include <DTWI.h>
#include <Wire.h>         //BUFFER_LENGTH = 256

uint8_t edid[256] = {
 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x4C, 0x2D, 0xF4, 0x0C, 0x45, 0x52, 0x46, 0x31, 0x15, 0x19, 0x01, 0x03, 0x80, 0x3C, 0x22, 0x78, 0x2A, 0x52, 0x95, 0xA5, 0x56, 0x54, 0x9D, 0x25, 0x0E, 0x50, 0x54, 0xBF, 0xEF, 0x80, 0x71, 0x4F, 0x81, 0xC0, 0x81, 0x00, 0x81, 0x80, 0x95, 0x00, 0xA9, 0xC0, 0xB3, 0x00, 0x01, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, 0x45, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x1E, 0x01, 0x1D, 0x00, 0x72, 0x51, 0xD0, 0x1E, 0x20, 0x6E, 0x28, 0x55, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x32, 0x4B, 0x1E, 0x51, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x53, 0x32, 0x37, 0x45, 0x33, 0x37, 0x30, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x62, 0x02, 0x03, 0x1B, 0xF1, 0x46, 0x90, 0x04, 0x1F, 0x13, 0x03, 0x12, 0x67, 0x03, 0x0C, 0x00, 0x10, 0x00, 0x80, 0x22, 0x23, 0x09, 0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x01, 0x1D, 0x00, 0xBC, 0x52, 0xD0, 0x1E, 0x20, 0xB8, 0x28, 0x55, 0x40, 0x56, 0x50, 0x21, 0x00, 0x00, 0x1E, 0x8C, 0x0A, 0xD0, 0x90, 0x20, 0x40, 0x31, 0x20, 0x0C, 0x40, 0x55, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x18, 0x8C, 0x0A, 0xD0, 0x8A, 0x20, 0xE0, 0x2D, 0x10, 0x10, 0x3E, 0x96, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3D
};

void receiveEvent(int receivedByte)
{
    if (receivedByte == 1)          //If there is 1 byte received
    {
      int receivedValue = Wire.read() << 1;
      receivedValue |= Wire.read();
      Serial.print("Read byte: ");
      Serial.print(receivedValue);
      Serial.println();
    }
    else
    {
        Serial.println("Not the amount of bytes that was expected: ");
        Serial.print(receivedByte);
    }

    while(Wire.available())
    {
        Wire.read();
    }
    return;
}

void requestEvent()
{
      Serial.println();

     for (int i = 0; i < 256; i++){
            Wire.write(edid[i]);               //Write EDID
            Serial.print(edid[i], HEX);      //Print EDID
            Serial.print(",");
     }

    Serial.println();
    Serial.println("Finished");      //Write is complete

}

void setup()
{
  Serial.begin(9600);
  Serial.println("**** HDMI ****");
  pinMode(2, OUTPUT);          //Hot plug detection
  Wire.begin(0x50);
  digitalWrite(2, LOW);
  delay(20);
  digitalWrite(2, HIGH);         //Source knows that a screen is attached and want to read the edid of the screen

  Wire.onReceive(receiveEvent);
  Wire.onRequest(requestEvent);
}

void loop()
{

}

The following attached pictures are the EDID handshakes without the Arduino involved.
Handshake 1: This is an HDMI 1.4 device
Handshake 2: This is another HDMI 1.4 device
You can see that the handshakes are the same.
My code only works on handshake 1.
Does anyone have an idea why it doesn't work on the other devices ?
Does it has to do with the Start/Restart ?
Regards !

I'm not an expert in HDMI/DDC, but I have some theories to remove potential problems:

"Wire.onRequest/Wire.onReceive" could be before "digitalWrite(2, HIGH)", to really represent "OK, you can send me data now" (Arduino isn't the fastest HW, and Arduino libs add extra overhead - lots of condition races can occur);
You could use "Write.write(did, 256)", instead of writing one byte to I2C then another via serial (again, racing conditions, specially since serial writing is slow);
If I'm not misunderstanding, the byte received from HDMI means the byte you should start transmitting EDID (ex: for "0", do a "Wire.write(edid, 128)", for "0x80", do a "Wire.write(edid + 0x80)"). This is a common approach for reading from PROM chips. HDMI have a 5V pin to allow PROM reading from turned-off devices, and byte 127 from EDID means "I may have more 128 bytes for you".
Are you doing simple tests, with unmodified data? Ex: read EDID from device X, test that same EDID, then test with modified data?


text:
Event driven programming
I have ran across a couple of different event libraries that are available on the AVR and Andruino but I am not sure which one is the best option. What I would like to do is design my program in a event driven style but not sure how to go about this.
I have a project that I need to keep lightweight but also in this program I have several actions that can be happening at any given time i.e. Digital Inputs being triggered and I need to run code whenever these events happen.
I found the QP Framework that looked promising but I wanted to get some feedback from some others that might of used this type of library before and might be able to provide some examples and maybe some experiences.
Another site I found here and lists all sorts of different libs

Cosa has to be the most fully featured of them all that I know of. Amazingly powerful and filled with drivers for everything you can imagine.  It's a completely different way of programming the Arduino - you'll have to unlearn everything you know ;)

@Majenko I had asked about OOP Programming (http://arduino.stackexchange.com/questions/17964/oop-vs-inline-with-arduino) does Cosa handle the problem with dynamically allocating memory?

It's pretty much all static objects.

@Andy Braham, if I may add to Majenko's statement, It's pretty much all static objects, which is a good thing.  As stated in the OOP thread, dynamic memory on small AVRs is not a good choice.  (It's something you have to un-learn.) Besides determinism, static binding also allows fantastic compile- and link-time optimizations.

Is the code that needs to be run interruptable?  How much latency can you tolerate?

You may want to take a look at LMX by David Anderson A Light-Weight Multi-Tasking Executive.
He has a very good set of videos on the code that he did for Dallas Personal Robotics Group (DPRG).
The specific videos for LMX are:

David Anderson on Robotics Software - part 1
David Anderson on Robotics Software - part 2

source: Stack Exchange

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

sort: votes


text:
TCP connection CPU usage, multiple signals?
I'm connecting a client (java program) to an arduino (server). What I want to know is, how high the CPU usage is, and what to do if there are no clients that are trying to connect to arduino? Should I make a delay?
My code looks like this:
EthernetClient client = server.available();

if(client){
    Serial.println("Connected");
    server.write("Hello\n");

    //check if client is still connected
    while (client.connected()){
        Serial.println("Still there");
        delay(2000);
       //check if client received any data
       if(client.available()){
           //read message from client
     }
  }
} else {
     Serial.println("Nope");
     server.write("Hello\n");
     ???????????? delay(2000); ??????????????
}

Thank you for your help.

You don't need to do anything. If the else clause has a delay (e.g. of 2 seconds), then it will take up to that long before the arduino accepts the connection.
The "server.write" in the "else" clause doesn't make any sense - who are you sendin it to? server.write will normally write to all available connections.
If there's nothing else you want to do, you might as well retry straight away.
Note that, if you are doing a serial.println statement, and you have no delay, then, while waiting for a connection, it will print the "Nope" message, as fast as it can.

Thank you for your answer! Oh okay, I understand, I'm quite new at arduino and connections, and I know that my code is nonsense :) so I just put a delay before that "Nope" and it will connect before throwing that "Nope"? And few more things: Is there a way to send a String to arduino (server) over TCP conection in one piece? I'm currently receiving byte by byte. Thank you for your time!

Does it make sense to print "Nope" every two seconds that you don't get a connection? For testing purposes, it may be entirely acceptable to do so, in which case a 2 second delay establishing a connection may also be ok. Yes, you should be able to send a string to an arduino in one piece (up to about 1kb); if it's giving it back one character at a time, it's likely an issue in your code - I suggest you post this as a separate question, as it's quite a different question from this one. Include both the sending and receiving code.

Normally, I would not have an "else" clause in code like this - if there is no incoming connection, there is nothing to be done (unless debugging). Just let it go around the loop again, as fast as it can.

So it has to loop over server.available() as fast as it can? Okay I'll ask another question.

Oh one more thing.. while client.connected() will return true for ever once it connects right?

client.connected() will return until one side or the other disconnects. Since there is no code in your snippet showing that the Arduino disconnects, it will keep returning true until the client disconnects. If you use the windows or linux 'telnet' command for testing, to disconnect, control-], press , then q

It doesn't have to do it as fast as it can - if there are other things you need to do in your code, you can easily do it between loops. However, there is no point in delay()ing it.

I have Java program (I asked another question as you said): http://arduino.stackexchange.com/questions/18137/sending-data-over-tcp-connection-in-one-piece So it will return true until my close() function?

As the Arduino typically has no demand-based clock scaling, or alternate threads of comparable priority you can schedule, there's really little point in using a delay (which is implemented as a busy-wait) rather than a tight loop - really, the primary appropriate reason would be to reduce the frequency of status output.
However, if you want to design a power-efficient system, you could consider sleeping the CPU between checking if there is anything worthwhile to do, or until an interrupt indicates that there is.  This is not something which delay() will take care of for you, so it is a fair amount of extra work and testing to get right, but it can be very worthwhile if running from batteries.
If your application is not particularly intensive you can also configure the clock divider fuse and slow the chip down generally.

Thank you for your answer! I'm not worried about power consumption, I'm more worried about overheating. This arduino will handle quite few thing (quite important too) and I don't want any problems.
Few more things: Is there a way to send a string over TCP connection in one piece? I'm currently reading byte by byte, but it would be great if there is any other more efficient way.
Oh and about TCP connection. Java program will have proper GUI and I want to know how to check if there is no connection? Try/Catch block, and program the catch block so it tells the user?
Thank you for your time!

Overheating and power consumption are very nearly two sides of the same coin, as it is power consumption which creates heat.  Effectively an ATmega won't get substantially busier than it already is running a typical busy-wait type of sketch as it typically does.  And unless you have other sources of heat, or very atypical thermal insulation of the package, that shouldn't be a problem.  Your regulator may produce some heat in normal operation though.  As for your other questions, SO rules are one question per post.

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


text:
sending multiple signals at the same time, with short delay
Is it possible to do something like this: send a HIGH signal to an output pin, after a 0.33s delay arduino sends HIGH signal to another pin, and after another 0.33s delay, arduino sends signal to third pin. There has to be 90 seconds long high signal for each pin, but with 0.33s delay between each other.
Sooo something like this; start of the high signal on left, stop on right side:
pin1: 0 ...... 90.00
pin2: 0.33 ... 90.33
pin3: 0.66 ... 90.66

Is there a way to solve this?

Yes. Read the BlinkWithoutDelay example and triplicate it.

Great, thank you! So if I just need to do it once (no need to blink in my case) I can do a while loop with a counter (to 3, for 3 pins), and increment the counter (+set the signal to LOW) when there is 90s (90000ms) from the start.


text:
I want to move the mouse pointer with an Arduino and ultrasonic sensor
I want to move the mouse pointer with an Arduino and ultrasonic sensor but when I compiled it says

Mouse.h not found

and I don't know what I can do.
Here is my code;
 #include <Mouse.h>

int echoPinCursor=2;
int trigPinCursor=3;

int echoPinBtn=4;
int trigPinBtn=5;
int echoPinScroll=6;
int trigPinScroll=7;
int x;
int y;
long duracionCursor, distanciaCursor;
void setup() {
 Serial.begin(9600);
 pinMode(trigPinCursor, OUTPUT);
 pinMode(echoPinCursor, INPUT);
 pinMode(trigPinBtn, OUTPUT);
 pinMode(echoPinBtn, INPUT);
 pinMode(trigPinScroll, OUTPUT);
 pinMode(echoPinScroll, INPUT);

}

void loop() {

    //mover el cursor
  int direccionx=moverx();
  int direcciony=movery();

  Mouse.move(direccionx, direcciony,0);
  delay(2);

}

int moverx(){
      distanciaCursor=obtener_distanciaCursor();
  if (distanciaCursor >= 1  || distanciaCursor <= 11){
       x--;
     }
   if (distanciaCursor >= 12 || distanciaCursor <= 24){
       x++;
      }
     return x;
}

int movery(){
      distanciaCursor=obtener_distanciaCursor();
     if (distanciaCursor >= 25 || distanciaCursor <= 37){
       y--;
       }
   if (distanciaCursor >= 38 || distanciaCursor <= 50){
       y++;
      }
  return y;
}

long obtener_distanciaCursor(void)
{
  digitalWrite(trigPinCursor, LOW);
 delayMicroseconds(2);

 digitalWrite(trigPinCursor, HIGH);
 delayMicroseconds(10);

 digitalWrite(trigPinCursor, LOW);
 duracionCursor = pulseIn(echoPinCursor, HIGH);

 distanciaCursor = duracionCursor/58.2;
return(distanciaCursor);

}

That's because the Uno can't be a mouse.  For that you need the Leonardo or something else with a similar "U" style microcontroller.
If you are adventurous, and you have a genuine Arduino, you can reprogram the USB controller chip with new firmware so it thinks it's a mouse, but programming the main MCU is then a real chore.


text:
UART Software Serial - Syncing two different sensors with start and stop bytes
I'm using 2 SRF02 sensors on the same Arduino board to attempt to have the transmitter only pulse the 40 KHz wave, while the receiver will be only taking a fake range, i.e. picking up a reading based on another transmission.
I've been using SoftwareSerial and need to know how to synchronize the time for the receiver to know when the transmitter sent the data. What I found is that I'm going to have to do this using start and stop bytes to set them in the same cycle.
How can I do this?
This is my current code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10,11); // RX, TX

void SendCmd(unsigned char address,unsigned char cmd) {
  mySerial.write(address);
  //set the address of SRF02(factory default is 0)
  delayMicroseconds(100);
  //serial data is fixed at 9600,N,8,2,so we need some time to create the second stop bit
  mySerial.write(cmd);
  //send the command to SRF02
  delayMicroseconds(100);
  //serial data is fixed at 9600,N,8,2,so we need some time to create the second stop bit
}
void setup(void) {
  Serial.begin(9600);
  mySerial.begin(9600);
  Serial.println("SRF02 TEST!");
}

void loop(void) {
  unsigned int reading;
  SendCmd(0x00,0x5C);
  //Transmit 8 cycle 40khz pulse from address 0x00 - transmitter
  delay(70);
  //time for SRF02 to measure the range
  SendCmd(0x02,0x57);
  //Get Fake Range at Address 0x02 - receiver
  delay(10);
  //wait for some time,let the Arduino receive 2 bytes data from the TX pin of SRF02
  if(mySerial.available()>=2) {
    //if two bytes were received
    reading = mySerial.read()<<8;
    //receive high byte (overwrites previous reading) and shift high byte to be high 8 bits
    reading |= mySerial.read();
    // receive low byte as lower 8 bits
    Serial.print(reading);
    // print the reading
    Serial.println("cm");
    //Serial.println("Time Sent: ");
    //Serial.print(T_sent);
  }
  delay(250);
  // wait a bit since people have to read the output :)
}

Your code bit
SendCmd(0x00,0x5C);//Transmit 8 cycle 40khz pulse from address 0x00 - transmitter
delay(70);//time for SRF02 to measure the range
SendCmd(0x02,0x57); //Get Fake Range at Address 0x02 - receiver

will send a sound burst, delay 70 ms, then start listening for the burst, which by then will have traveled around 24 meters and probably be no longer audible.
You should instead start the fake range listener immediately after sending the burst.  The general idea for one approach is as follows:

Record time (eg, t1=micros();)
Send burst (eg, SendCmd(0,0x5C);)
Record time (eg, t2=micros();)
Listen for burst (eg, SendCmd(2,0x58); // Get microseconds)
Wait 70 ms, then read microseconds result t3
Compute corrected total microseconds, tm=t3+t2-t1
Convert microseconds to cm

Note use of command 0x58 instead of 0x57 to get microseconds instead of cm.  If you used 0x57, instead of adding t2-t1 to t3, you would add t2-t1 microseconds-converted-to-cm to a cm reading.
The reason for the computation tm=t3+t2-t1 is that the second command is issued about t2-t1 microseconds later than the first command, as explained in the next paragraph.
There is an unknown delay d1 between when t1 is recorded and when the first SRF02 acts; and there is an unknown delay d2 between when t2 is recorded and when the second SRF02 begins listening.  The correct amount to add to t3 is t2+d2-(t1+d1), which is t2-t1 if d1 equals d2, a more-or-less plausible assumption.  If your experiments reveal a constant error, add a small constant offset to compensate.
I doubt you should have the delayMicroseconds(100); statements in SendCmd(), and would recommend getting the code to work ok, then see if it still works ok when you take them out.  The delay(10); is unnecessary if you rewrite your 2-character-wait correctly (ie as a while rather than an if), and the delay(70); is unnecessary if you start conversion with command 0x5A,  “Fake Ranging Mode - Result in centimeters, automatically Tx range back to controller as soon as ranging is complete” and then properly wait for two characters to arrive, instead of a blind wait followed by a test if they've arrrived.

unsigned int reading;
unsigned long t1=micros();
SendCmd(0, 0x5C);//send pulse with transmitter
unsigned long t2=micros();
SendCmd(2, 0x58);//return value in microseconds
  delay(70);//time for SRF02 to measure the range //SendCmd(0x02,0x5E);
  unsigned long t3 = SendCmd(2,0x5E);
  unsigned long tm = t3+t2-t1;

 unsigned int reading;
  unsigned long t1=micros();
  SendCmd(0, 0x5C);//send pulse with transmitter
  unsigned long t2=micros();
  SendCmd(2, 0x58);//return value in microseconds

  delay(70);//time for SRF02 to measure the range
  //SendCmd(0x02,0x5E);
  unsigned long t3 = SendCmd(2,0x5E);
  unsigned long tm = t3+t2-t1;

Hey thanks for the input. When I created t3, I get an error saying void value not ignored as ought to be.

After you do SendCmd(2,0x5E);, you need to read the serial reply from 2nd SRF02, and store that 16-bit value into t3.

i dont know how to store the value returned, it tells me the the void value not ignored as ought to be. am i not supposed to use t3 = SendCmd(2, 0x5E) to store ?

SendCmd() doesn't return a non-void value, so you aren't supposed to say something = SendCmd(...).  Instead, just issue the SendCmd(2, 0x5E), then read 2 serial bytes and combine into 16-bit value, like you did for reading

This is my updated code based on your suggestions, jwpat, although I did not understand your comment with delay(70); not being needed if I start conversion with (2,0x5A).
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10,11); // RX, TX

void SendCmd(unsigned char address,unsigned char cmd)
{
  mySerial.write(address);//set the address of SRF02(factory default is 0)
  //delayMicroseconds(100);//serial data is fixed at 9600,N,8,2,so we need some time to creat the sencond stop bit
  mySerial.write(cmd);//send the command to SRF02
  //delayMicroseconds(100);//serial data is fixed at 9600,N,8,2,so we need some time to creat the sencond stop bit
}
void setup(void)
{
  Serial.begin(9600);
  mySerial.begin(9600);
  Serial.println("SRF02 TEST!");
}
void loop(void)
{
  unsigned long t3;
  unsigned long t1=micros();//time tx command issued
  SendCmd(0, 0x5C);//send pulse with transmitter
  unsigned long t2=micros();//time rx command issued
  SendCmd(2, 0x58);//listen for pulse
  //SendCmd(2, 0x5A);
  delay(70);//time for SRF02 to measure the range
  //SendCmd(0x02,0x5E);
  SendCmd(2,0x5E);//Get range

 while(mySerial.available()>=2)//if two bytes were received
  {
    t3 = mySerial.read()<<8;//receive high byte (overwrites previous reading) and shift high byte to be high 8 bits
    t3 |= mySerial.read();// receive low byte as lower 8 bits
    unsigned long Tm = t3 + t2 - t1;//total amt of microseconds between pulse and reading
    unsigned long Dist = (Tm/29); //converting microseconds to cm
    Serial.print(Dist); // print the reading
    Serial.println("cm");
    //Serial.print(tm);
    //Serial.println("ms");

  }
  delay(250); // wait a bit since people have to read the output :)
}

After running this code my results keep being the following values regardless of me shifting the distance between the sensors:
72cm

Instead of while(mySerial.available()>=2) { t3 = mySerial.read()<<8; ... as you have, say  while(mySerial.available() < 2) {};  t3 = mySerial.read()<<8;. That is, you need to stall until two characters are available from the 5E command, and then read them.  Probably what's happening now is that first time in, since mySerial.available()>=2 is false, your while doesn't run; so you return from loop() and then loop() and steps on the ongoing conversion, messing it up; eventually two characters arrive; and this happens over and over the same way.  Note, you should edit this stuff into Q

I made the changes and what i now get is a value of 2302cm in my Serial Monitor

Perhaps you can edit your question and put current code into it.  2302cm is about the distance one expects for a 70 ms delay.  If you are indeed now using while(mySerial.available() < 2) {}; to stall until 2 chars are available you should be able to remove the 70 ms delay and change from 58 command to 5A command.  (Adding "answers" that are really part of the question is a no-no. Edit the question instead.)

gotcha, i just dont have enough space for the new code

also what did you mean by edit into Q?

I meant, edit the items you've been putting into "answers" into the Question.  By "not enough space for the new code", are you referring to the IDE, the target Arduino, or this post?

I was talking about the comments for my replies, but i got it thanks a lot for your help. I updated the new code in another question.

hey I would really appreciate f you can look at my code once more on the new post or even just point me in the right direction. link: http://arduino.stackexchange.com/questions/18123/uart-software-serial-syncing-two-sensors-updated


text:
Synchronizing two sensors on uart, make one receiver and one transmitter
I need to make a transmitter and receiver with each specifically transmitting and receiving a signal. I am using two SRF-02 sensors, one is the designated transmitter, the other the receiver.
My issue is that the receiver is not currently able to pick up the reading, reason being that the receiver has no idea of when the startbyte is incoming or when the stop byte comes.
Can i send the receiver a start byte when i activate the transmitter and send an end byte for when the signal is received?

Please provide links to this sensor. Please post your code. I'm going to close this question as "unclear what you are asking". Feel free to edit it with new information. Thanks for your understanding and cooperation!


text:
Problem in Uploading a Bootloader to Atmega8A
I am getting an error while Uploading the Bootloader to Atmega8A
I am selecting..
  Board -> Arduino NG and Older
  Processor -> Atmega8A
  Programmer -> USBasp

and sketch code is ArduinoISP, After selecting port then I do "Burn Bootloader"
But getting an error of...
   "efuse" memory type not defined for part "ATmega8"
    Error while burning bootloader.

Please tell me what to do. Any help will be appreciated.
Thank you

I used Programmer "AVRUPro+" for Uploading Program. I downloaded its Software "Progisp" Then I did some few steps....
1) After downloading it, Run the Progisp.exe file.
2) Then went to Command tab, and clicked “Program Fuse”, It just did my fuse  set.
3)Then I just did the simple process of burning the bootloader to my Atmega Controller.
4)After this I was able to upload my program to my new Atmega Controller.
Thank you

Google is your friend!!!
Apparently this is a known regression bug not yet corrected. The possible solution is also suggested there by user rigelinorion and here is the quote:
Hello, I solved it this way...

Open for edit the file C:\Program Files\Arduino\hardware\arduino\avr\platforms.txt
this is standard section uploader/programmers tools

#==============================================================================
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
tools.avrdude.cmd.path.linux={runtime.ide.path}/hardware/tools/avrdude
tools.avrdude.config.path.linux={runtime.ide.path}/hardware/tools/avrdude.conf

tools.avrdude.upload.params.verbose=-v -v -v -v
tools.avrdude.upload.params.quiet=-q -q
tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude.program.params.verbose=-v -v -v -v
tools.avrdude.program.params.quiet=-q -q
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude.erase.params.verbose=-v -v -v -v
tools.avrdude.erase.params.quiet=-q -q
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Uefuse:w:{bootloader.extended_fuses}:m -Ulock:w:{bootloader.unlock_bits}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude.bootloader.params.verbose=-v -v -v -v
tools.avrdude.bootloader.params.quiet=-q -q
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.ide.path}/hardware/arduino/avr/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m
#==============================================================================

create a new tool called, for example, avrdude1
simply copy section tools.avrdude and name it tools.avrdude1
the trick is that we remove switch "-Uefuse:w:{bootloader.extended_fuses}:m" from "tools.avrdude1.erase.pattern="

#=============================================================================
tools.avrdude1.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude1.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
tools.avrdude1.cmd.path.linux={runtime.ide.path}/hardware/tools/avrdude
tools.avrdude1.config.path.linux={runtime.ide.path}/hardware/tools/avrdude.conf

tools.avrdude1.upload.params.verbose=-v -v -v -v
tools.avrdude1.upload.params.quiet=-q -q
tools.avrdude1.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude1.program.params.verbose=-v -v -v -v
tools.avrdude1.program.params.quiet=-q -q
tools.avrdude1.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude1.erase.params.verbose=-v -v -v -v
tools.avrdude1.erase.params.quiet=-q -q

#this line was edited
tools.avrdude1.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude1.bootloader.params.verbose=-v -v -v -v
tools.avrdude1.bootloader.params.quiet=-q -q
tools.avrdude1.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.ide.path}/hardware/arduino/avr/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m
#==============================================================================

Here is an example of the use of the tool avrdude1 in boards.txt file

atmega8.name=ATmega8 OPTIBOOT
atmega8.upload.protocol=arduino
atmega8.upload.maximum_size=7168
atmega8.upload.speed=115200
atmega8.upload.tool=avrdude1
atmega8.bootloader.low_fuses=0xbf
atmega8.bootloader.high_fuses=0xCC
atmega8.bootloader.path=atmega8
atmega8.bootloader.file=optiboot/optiboot_atmega8.hex
atmega8.bootloader.unlock_bits=0x3F
atmega8.bootloader.lock_bits=0x0F
atmega8.bootloader.tool=avrdude1
atmega8.build.mcu=atmega8
atmega8.build.f_cpu=16000000L
atmega8.build.core=arduino
atmega8.build.variant=standard

If it's a regression bug, you could also try using an older version of the Arduino IDE.

@Gerben, yes indeed, a valid solution too. However I would probably stick with this solution because this is a minor issue compared to maybe a lot of bugs or improvements done in new IDE's.

Thanks to all of you, I got it, Actually there was the fuse bit problem.

@Naveen Thats great. Post your solution here and mark it as answer because it may help others too.


text:
Problem up loading to board
I'm a newbee to Arduino programming and hoping someone can help me with this. These are the errors when uploading the proceeding sketch. Thanks in advance!
avrdude: stk500_rcv() : programmer is not
responding
avrdude: stk500_getsync() attempt 10 of 10:not in sync:
Problem uploading to board.
//www.RobotLinking.com
//2015.5.7
/************************************************/
#include <Servo.h>
/************************************************/
Servo myservo;//create servo object to control a servo
/************************************************/
void setup()
{
  myservo.attach(9);//attachs the servo on pin 9 to servo object
  myservo.write(0);//back to 0 degrees
  delay(1000);//wait for a second
}
/*************************************************/
void loop()
{
  myservo.write(15);//goes to 15 degrees
  delay(1000);//wait for a second
  myservo.write(30);//goes to 30 degrees
  delay(1000);//wait for a second.33
  myservo.write(45);//goes to 45 degrees
  delay(1000);//wait for a second.33
  myservo.write(60);//goes to 60 degrees
  delay(1000);//wait for a second.33
  myservo.write(75);//goes to 75 degrees
  delay(1000);//wait for a second.33
  myservo.write(90);//goes to 90 degrees
  delay(1000);//wait for a second
  myservo.write(75);//back to 75 degrees
  delay(1000);//wait for a second.33
  myservo.write(60);//back to 60 degrees
  delay(1000);//wait for a second.33
  myservo.write(45);//back to 45 degrees
  delay(1000);//wait for a second.33
  myservo.write(30);//back to 30 degrees
  delay(1000);//wait for a second.33
  myservo.write(15);//back to 15 degrees
  delay(1000);//wait for a second
  myservo.write(0);//back to 0 degrees
  delay(1000);//wait for a second
}
/**************************************************/

if you google for avrdude: stk500_getsync() attempt 10 of 10:not in sync: there is a lot of topics and possible answers that could suit your needs.

Which board? Which OS? What is wired to the board? Is it a genuine one or a clone?

Oh, the formatting -.- anyway... Can you upload another sketch on the board? Usually people use the blink example...

Code formatting is fubared. You need to put four spaces in front of each line...

One of the first things to know about Arduinos is that that there are a lot of them – and a lot of tools for programming them. For your problem this means that the most likely reason for the problem you are having is a mismatch between the board your are using and the board your tools are set to upload to. Since you've said you're new to the Arduino I'm assuming that you're using the "official" IDE.
So, here are some things to try:

From the IDE main menu, choose Tools > Board and select your board, then
Choose Tools > Programmer and select an appropriate programmer for your board. Without knowing what board you're using and how you're connecting to it I can't offer more specific advice. However, if you Google for something like "beginner tutorial " you're likely to find an answer. Or more likely three answers. You'll need to look at the one that matches the OS you're using on your development machine.
You may also need to select the port that the Arduino is connected to.

If you've gotten this far and haven't solved the problem, here's what I'd do next:

Do a search on the exact error message you're getting – copy it out of the IDE and the paste it into your favorite search engine. Put quotes around the message so that you don't get a bunch of unrelated hits for your search.
Search for tutorials on the board and/or IDE vendor site.
Work through a tutorial from a good beginner's site. I like the materials the Adafruit folks have developed, but there are lots of good resources out there.
Post a question. When you do be sure to:

Describe your environment: the board you're using, the IDE you're using, the OS you're working on, how the board is connected to the development machine, and the basic settings of the IDE.
Explain what you've tried.
Describe, or better, include a screen shot or the actual text of the problem that you're seeing (like you did here).
For some problems it will also be useful to include the code. If you include the complete code then it is possible that somebody could try to actually reproduce your problem.

I think I may have found the answer to my problem. Like I mentioned I am new to the Arduino world. I did not burn the 432 on the UNO. How come the 432 isn't burned at the factory. I'm I proceeding in the right direction to burn the 432? Excuse my ignorance!


text:
Arduino outputs garbage values on serial monitor with ESP8266
I have connected my Arduino with an ESP8266.
When I check the ESP8266, by manually entering commands at serial monitor, I get correct results.
However, when I run this program
#include<SoftwareSerial.h>

SoftwareSerial esp8266(2,3);

void setup() {
  Serial.setTimeout(5000);
  Serial.begin(115200);
  esp8266.begin(115200);
  delay(1000);
}

void loop() {
  delay(2000);
  String command="AT";

  esp8266.println(command);
  if(esp8266.available())
  {
    while(esp8266.available())
    {
      char c=esp8266.read();
      Serial.write(c);
    }
  }
}

I get garbage values where sometimes it has an OK in between the output:

" Received: "ÁT OK " Received: "AÔ ÏË " Received: "AÔ OK " Received: "ÁT ÏË " Received: "ÁT OË " Received: "ÁÔ OK " Received: "Á¬ OK " Received: "ÁT OË "

Could someone help me?

Is your serial monitor configured for 115200? Did you check the ESP with a serial monitor at 115200? Can you post the garbage? Did you look on the wires with an oscilloscope?

Yeah frarugi87. I kept the serial monitor at 115200.

Ok @abdul rahuman, try using if(esp8266.available()) { Serial.print("Received: \""); while(esp8266.available()) { char c=esp8266.read(); Serial.write(c); } Serial.println("\""); } and post back the output of the serial monitor

@frarugi87 i got this upon your code. "
Received: "ÁT
OK
"
Received: "AÔ
ÏË
"
Received: "AÔ
OK
"
Received: "ÁT
ÏË
"
Received: "ÁT
OË
"
Received: "ÁÔ
OK
"
Received: "Á¬
OK
"
Received: "ÁT
OË
"

@frarugi87 as you could see it prints OK sometimes at but it prints some garbage combination with OK. so please help me.

How do you power your ESP8266? is it from 3.3v of arduino. I would recommend powering it separately. I had these issues and when I powered it using LM1117 regulator, it worked. Also if you are working on breadboard, you will run into similar issues due to loose connection. Try soldering the connections.

I have now flashed it with a newer firmware version. Now the problem of garbage values is reduced. I mean reduced but not completely gone. I now get the actual response in between a junk of garbage values. But it works perfectly sometimes. @Sherin Mathew

I have been facing these issues during last month. But now it is working fine after spending too many hours of trial and errors. I was trying to use ESP8266-01 along with arduino to switch on a florescent lamp. I'm able to do it now without using arduino. I use only the ESP8266-01 with nodemcu. It is working perfectly for the past few weeks. Please let us know what you are trying to do so that we can help you decide whether arduino is required in your case.

I am trying to controls relays and make an IR cloner. @Sherin Mathew

As noted by Matt, the baud rate for the ESP8266 can vary depending on the firmware version/manufacturer.  9600 and 115200 are the most common.  If you can connect using a serial terminal program (like CoolTerm) you can then test the baudrate.
It sounds like the ESP8266 is set to 115200, but in my experience (and others') SoftwareSerial isn't capable of 115200 baud rate (despite "allowing" this as a setting). Some reports suggest as high as 57600 is workable, though in my experience 9600 is best for reliability.  But you can reset this and see what the max reliable value is for you in your configuration.
How to change the baud rate on the ESP8266 will depend on the firmware version. I've had success with AT+IPR=9600. You only need to run this command once (it's a persistent setting). I'd suggest, based on your description, that this is the most likely culprit that's causing the intermittent "garbage" output you describe.

Using 115200 has too many instructions for the Arduino Uno to reliably decode characters and that's where the garbage is coming from.
The ESP8266 default baud is 115200, so you need to connect at the default rate and issue an AT command to reduce the baud rate to 9600.
Each time you reset, the ESP8266 goes back to the default baud rate.
Here's an example script that connects at the default baud rate and then reduces it to 9600. You'll connect the Serial Monitor at 9600. At the lower baud rate, I'm not getting any garbage characters.
#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3); // RX | TX

void setup()
{
  Serial.begin(9600);
  ESPserial.begin(115200);
  ESPserial.println("AT+IPR=9600");
  delay(1000);
  ESPserial.end();
  // Start the software serial for communication with the ESP8266
  ESPserial.begin(9600);

  Serial.println("Ready");
  ESPserial.println("AT+GMR");
}

void loop()
{
    // listen for communication from the ESP8266 and then write it to the serial monitor
    if ( ESPserial.available() )   {  Serial.write( ESPserial.read() );  }

    // listen for user input and send it to the ESP8266
    if ( Serial.available() )       {  ESPserial.write( Serial.read() );  }
}

An odd thing that happened to me is that I tried to use a baud rate of 4800 and I bricked one ESP8266 module. I don't know if that was a glitch or just a coincidence.

Great. After trying this, my esp8266 blinks blue led repeatedly stuck in a loop. Good answer. +1000.

Using AT+IPR is a very dangerous command. Many ESP8266 will get bricked after the command. The only way to do it is by flashing your ESP to a 9600 baudrate.
I just had to do this myself with a friend today after using the AT+IPR command and loads of websites tell you to never use the command.

Finally, solved garbage symbols in serial monitor by lowering the ESP's baud rate from 115200 to 9600 with the following command:
AT+UART_DEF=9600,8,1,0,0
The root cause of the problem is speed limitations of the SoftwareSerial. On hardware Serial connection, it should work ok with speeds up to 115200.
There is my ESP AT+GMR info:
AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(5a875ba)
v1.0.0.3
Mar 13 2018 09:37:06

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


text:
Is it possible to simulate PWM using delay() function?
I was thinking about if it is possible to simulate PWM (AKA pulse width modulation).
Is it possible to reach the speed of the PWM using the delay() function ?.
Note : I am talking about the pins which does not support PWM, Arduino uno Pin 13 for example.

Why do you want to? Please specify what speeds you are hoping to achieve. The hardware can output 8 MHz. Simulated PWM cannot.

It is possible to create a PWM signal from a non-PWM digital pin although you would not want to use delay, but timer interrupts for accuracy and finite timing. PWM intervals are typically measured in (μs[microseconds] vs ms[milliseconds]).
The standard Arduino servo library  does this: Servo.

It would be possible to do it. Would it be a smart thing to do ?
I do not think so. Micro-controllers (not just Atmel's) have dedicated hardware modules to manage the signals for PWM. What happens when you use AnalogWrite is the compiler/interpreter/whatever uses these informations to modify the appropriate registers so the toggling is not managed by the code.
If you use the delay() functions, you are simply letting clock cycles pass by until the time you set is passed which is a lot less efficient. Plus, you would probably not get the same PWM frequency.

What you are talking about is more appropriately called Bit-Banging. Check out this link. It even has an example of what you are trying to do. @Jason is correct that it causes a number of issues. The link above will also run you through the draw backs of this method which I will summarize.

Jittery due to interrupts (Interrupts can be disabled)
The Processor cannot do anything else and keep the output working
Frequency and Duty Cycle are difficult to determine

If you disable interrupts, delay will no longer work.

@Gerben Right, so in that case I'd use millis() and use a similar method without delaying the function. That would get rid of the first issue. The second problem might also be fixed as long as your Timer ran fast enough to catch each cycle.

Sorry :-p. Without interrupts, millis is not updated.

I think it depends on what you want to use it for. I compared using PWM and bit banging to run a small DC motor.  PWM produced an audible whine that I found very irritating.  Using the delay function removed that (a delay on/off cycle of 10 milliseconds).  I also found that it was relatively easy to control not only the ratio of on/off (PWM) but also the length of the cycle.  This was useful for starting the motor with a slightly higher "push" to get it moving. (I'm sure that this could be done using PWM too) With respect to performance of the engine, I didn't find much actual difference.
The key issue with a DC motor is that while the digitalWrite() is LOW, the inertia of the motor carries the rotation on and so the effect of the delay is smoothed.  In addition the RPM of the motor wasn't critical for my application.
However, if one was running a LED then using delay() might be visibly discernable and cause discomfort (and possibly seizures?).  For this, I'd definitely use PWM.
regards
Mark


text:
How to confirm a pin is fried
How do you confirm a pin has been damaged and is unable to work as a digital input?
I tried detecting a pushbutton (connecting ground to pin 11 with a pullup resistor enabled) on a fresh Arduino Uno and digitalRead() always registers 0, regardless of the pushbutton state.
To confirm it wasn't my pushbutton's wiring, I tested it on some other pins, and they register the button press perfectly. I then tested pin 11 as an output, and it was able to blink and LED just fine.
The Arduino's pretty new, and I don't remember doing anything with it that would have damaged anything, much less pin 11, but is it fair to say that pin has somehow been damaged? As far as I can tell, everything else on the Arduino works perfectly.

Try using an external pull-up. It might just be that the internal pull-up is fried, and not the input logic.

Check your breadboard if you are using one. I thought that my pin was fried one time, but it turned out that the breadboard wasn't working in that area(no connection).

Yes, it sounds like that pin is fried.
You seem to have done all the things I would recommend:

Try your circuit on a different pin (works fine)
Try your circuit on the same (faulty) pin on a different microcontroller (works fine)

If you get different results between two chips that should be the same with the same code running on them then one of them is most likely faulty in some way, or has some other setting in it (fuse setting) that could be affecting it.  I am not aware of any settings like that on the '328P, certainly none that you would change without knowing you had changed them.


text:
How to check if a pin is set from bank?
How would you go about checking if an input pin has been set using the entire bank? I am thinking that I need to use bit twiddling with a bit mask but I have not used this enough to figure out how to do what I want.
Basically I have the following code:
void setup() {
   DDRA = 0x00;
   PORTA = 0xff;
}

void loop(){
   //Check if any pin from Port A has been pressed
   if (PINA & 0xff){
      //do stuff
   }
}

But the code above is not working how I expected it to. Has anyone tried to use this approach before? Am I going about this the wrong way? I figured since I was using all 8 pins from one bank, it would be better to check if any of the pins on that bank have been set instead of checking each individual pin. My thinking on this was to prevent any user input from being skipped in case a button press was initiated while the program was running other code. This way I only check if anything in the bank has been set saving time (I think).

If you attached the buttont towards ground then the "pressed" state is the 0, so "any button pressed" is coded in the instruction if (PINA == 0xff) or if (~PINA & 0xff).

The problem is here:

//Check if any pin from Port A has been pressed
if (PINA & 0xff){

Since the pullups are enabled, the default state of the pins is high. To detect a "press", they have to be pulled to ground. This changes the test to:
//Check if any pin from Port A has been pressed
if (~PINA) {

And for individual pins:
//Check if PA3 has been pressed
if (!(PINA & _BV(PA3))) {

When I run the code if (~PINA) it always enters the loop no matter what. Did this work for you, did you test this?

I tried your code and it will always enter the loop but if you change the code to if(~PINA & 0xff){ ... } it works.

~PINA assumes that all 8 pins are being used for active-low input. If only part of the port is being used then you need to mask the pins in use.

The simplest way is to use DigitalRead in a loop. It makes your code more portable, and easier to read.

The whole point was so I didn't have to read each Pin individually, I will have many more Inputs eventually and the time spent checking each Input might not catch everything.

There's a maximum of 20 inputs on the Uno; at 16 mhz, you would be checking them at hundreds of thousands of times per second (that gives you 8 instructions per pin). Sometimes you need that; often you don't.

I'm not really an expert in "plain avr code" but I've modified arduino blink and got (almost) a perfect example. Placed a jumper between 5v and pin 8 of arduino and uploaded the following code:
void setup() {
  // initialize digital pin 13 as an output.
  DDRB = 0b00100000;

}

// the loop function runs over and over again forever
void loop() {
  if (PINB & 0x1) {
    PORTB =  0b00100000;  // turn the LED on (HIGH is the voltage level)
    delay(500);              // wait for a second
    PORTB = 0;    // turn the LED off by making the voltage LOW
    delay(500);              // wait for a second
  }
}

according to following picture pin8 on arduino is PB0 and pin13 is PB5. So using DDRB I set PB5 as output and all others as input. Then in loop I check as you do PINB register and use bitmask to check first pin (the PB0). And it works... well not quite well. For some reason the loop goes a few times more before goes really low. I believe is because I just remove the jumper and do not actually ground pin 8 ( is left float) and maybe the extra loops are discharging some capacitance on that pin 8.

(source: arduinoexperts.com)
So, to your specific question, your bitmask is right. This instruction PORTA = 0xff; is useless because, as far as I know, this settings are ignored because you set Pin direction in pins of PORTA to input. However, according to that image, atmega328 doesn't have a PORTA. Is that your error or are you using another microcontroller?
EDIT Capacitance thing is confirmed, maked it swing between gnd and vcc   with a switch and all works fine.

"This instruction PORTA = 0xff; is useless" Incorrect. On modernish, largish AVRs this sets the state of the internal pullup resistor.

@IgnacioVazquez-Abrams Thanks for pointing that out. And reading your answear it all makes sense. Always learning :)


text:
Is there any way to flash sketches using custom firmware?
I am using HIDUINO as my firmware (flashing via dfu-programmer), and to upload sketch I need to re-flash original firmware, upload sketch and then flash HIDUINO again.
Is there a way to flash sketches without reflashing original firmware?

Is the firmware built to start in the bootloader section? Are the appropriate fuses set?

@IgnacioVazquez-Abrams um, I have no idea

I assume you mean you are reprogramming the USB interface chip, which means you no longer have a UART pathway through to the ATMega328P. If so then yes, you can provide your own USB interface in parallel by connecting an FT232 (or similar) breakout board direct to the ATMega328P chip just like you would on a breadboard Arduino:

FTDI TX -> Arduino RX (Yellow)
FTDI RX -> Arduino TX (Blue)
FTDI DTR -> 100nF Capacitor -> Arduino RESET (Green)
FTDI GND -> Arduino GND (Black)

The capacitor is required with later versions of avrdude and newer versions of the Arduino IDE since the DTR signal is now held LOW rather than being pulsed as it used to be.  This is to combat a change in the FTDI drivers that meant that the DTR stopped being driven at all and broke the auto-reset facility.  So now we need a capacitor to convert a constant LOW into a short low-going pulse to initiate a reset without locking it all up.

Or use a second Arduino for this.

Yes, but that's wasteful :)


text:
Is there something I can use to control Arduinos easily over Ethernet with .NET?
I'm wondering if there's anything out there that maybe works pretty similarly to Firmata, runs on Unos or Megas, and can be controlled over Ethernet. I am writing a home automation system with .NET, and I see some options for supporting Firmata with .NET, but I want to be able to connect my devices over Ethernet.

I don't use .net but I have done this using php website to control a door lock over ethernet.
My solution was to use the ethernet to recieve commands and be able to use them on the arduino through http calls. And when it was done send a http call back to the server with some data. I was doing a door lock program for example. Please ignore anything talking about doors, locking, unlocking, or other requirements to certain calls, I am just providing examples about how it COULD be used, not that you need to include my door lock code in your project to get it to work.
As far as how that works out with .net that's up to you, however I can give you a hand getting your messages back and forth.
first you want to create the ethernet connection to your router. put this in your header section.
#include <UIPEthernet.h>
// assign a MAC address for the ethernet controller.
// fill in your address here:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};

// fill in an available IP address on your network here,
// for manual configuration:
IPAddress ip(127, 0, 0, 1);

// initialize the library instance:
EthernetClient client;

char server[] = "www.example.com";
//IPAddress server(127,0,0,1);  // numeric IP for www.example.com (no DNS)

int waitTime = 3L;

unsigned long lastConnectionTime = 0;             // last time you connected to the server, in milliseconds
const unsigned long postingInterval = waitTime * 1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers

throw this in your main loop so it doesn't constantly make http requests spamming a server.
// if ten seconds have passed since your last connection,
// then connect again and send data:
if (millis() - lastConnectionTime > postingInterval || buttonState == 0) {
  httpRequest();
}

Create a method to handle httpRequest because shoving everything under the main is kinda sloppy.
Alright so there will be quite a bit here because http headers are kinda lengthy.
// this method makes a HTTP connection to the server:
void httpRequest() {
  // close any connection before send a new request.
  // This will free the socket on the WiFi shield
  client.stop();
  // if there's a successful connection:
  if (client.connect(server, 80)) {
    Serial.println("connecting...");
    // send the HTTP PUT request:
  Serial.println("String is " + readString);
  if(readString == "Ready" || readString == ""){
    client.println("GET /command.txt HTTP/1.1");
    where = "web";
    waitTime = 5L;
  }
  else{
    // here is the basic format of sending a get command
    //this specific request is so that I can tell where the command came from. I had a web client / mobile app that could control the door AND you could also control it from a physical buttom. The door would have to reply either way to the web server (READ: .net application) in order to have the correct status always show up on the web end.

    client.print("GET /update.php?where=Arduino&command=Ready&status=");
    if(readString == "Reset"){
      client.print("Reset");
    }
    else if(isLocked){
      client.print("Locked");
    }
    else{
      client.print("Unlocked");
    }
    client.println(" HTTP/1.1");
    waitTime = 1L;
  }
  client.println("Host: www.example.com");
  client.println("User-Agent: arduino-ethernet");
  client.println("Connection: close");
  client.println();

    // note the time that the connection was made:
    lastConnectionTime = millis();
  }
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");
  }
}

TL;DR if you wanna use ethernet you need to use all of ethernet.
Start by creating your connection to the router statically (watch for conflicts).
Then create a method of watching for incoming data or waiting for a command if there isn't one. (server call).
Then create A FULL HTTP REQUEST in order to pass your request through. Shorting any parts of this last part and you will either end up with bad request errors or will simply fail.
Let me know if you need anything else or if this was useful to you!

Having to run a web server might be a bit of an uncomfortable requirement for how I'm coding this application. It's a VB .NET console application effectively (currently it has a form, but I'm going to get rid of it), and since I'm going to control various devices, including a few direct serial, and a few various Ethernet devices likely, I don't want to have it serve web just to control Arduinos.

I was hoping for something a bit lighter on the server. I almost recall some examples where the actual "web server" bit was on the Arduino, which might be a more elegant solution, in terms of my automation controller just needing to make HTTP requests that way.
I had just been hoping there might be something a bit more pre-packaged and already out there I didn't know about.

You don't have to. You asked about how to use ethernet to send data. You can pass php to a single local page on a local computer. Have that write the data to a text file and have your vba program pick that up. How did you think ethernet worked?

Also using arduino as a web server is very Ill advised

But doesn't that single local page need some sort of web server on the PC to serve it up so it's reachable by the Arduino? What's the reason for ill-advisement on using the Arduino as a web server for similarly minimal commands?

Yes, I guess it does. It was a long night mb. You're welcome to try it but I had performance issues and it wasn't stable. Came down to space and flexibility. There are light weight servers out there so you don't have to run full blown apache if you don't want to.

Poor stability would definitely be an issue for me. I do have like Megas I can work with, which I'd hope would handle the added load okay. (Megas are $10 now at a local store.)

Do what you want man. I've been working on these for a year. Up to you how to solve your problems. Some answers are easier than others


text:
Interface pressure Sensor
Hello folks,
              I am using G1/4 Pressure Transmitter Sensor 0-1.2 MPa sensor can you guide for programming part.The conversion from bar to pascal  or bar to Mpa or pascal to psi.Though I am new to it. Plz guide me .

I'm assuming you mean that you want to pull a voltage number off of an input pin and convert it to a meaningful number.
To do this find the range of the incoming voltage.
Find the range of the sensor.
After that you need to split the voltage up to show what parts of the range convert to how much psi.
Here is an example of a temperature gauge that has the same principle.
Temp sensor

I done by this way it is right to do this?
 int rawReading = analogRead(A0);   // Range : 0..1023
float millivolt=(rawReading*4.882);

float rawVoltage = (rawReading * (4.5 / 1023.0)) + 0.5;
byte psi = (rawReading-102)/8;
float bar = psi0.07;
float MPa = psi0.006894759086775369;

Looks good to me. Do you think those numbers are accurate after testing done readings?

I dont know i search on it and find this values.It shows the output but dont know it is right or wrong

Logically what you did sounds right. I don't have your sensor in front of me so I can't help you as far as that goes.

One thing that I would add to this is that if you need good accuracy you may want to apply a voltage equal to your full scale output to the AREF pin. The value on AREF does not have to be equal to the full range of the sensor – just to the maximum value you will get – if you will never see readings at the extremes of the sensor's range you can set your AREF below the maximum value and get higher resolution.
Tronixstuff has a good tutorial on the AREF pin that goes into considerable detail about how to configure the pin and use the analogReference() function.


text:
Array of strings - how to determine the number of elements present
I would like to use an array of strings which I define as follows:
char* CommandQueue[]={"FirstCommend", "SecondCommend", "ThirdCommand", "Cmd4", "Cmd5"};

The purpose of this array is to hold commands ("strings of various lengths") that the Arduino will receive through a serial port. Those commands will be interpreted by calling appropriate callback functions to act on them. The CommandQueue is supposed to line up the commands in a sort of "buffer".
Initially the "CommandQueue" array does not contain any elements and gets populated during the runtime of the project. The  array will continuously be interrogated and once a command is interpreted (and the corresponding function executed) the command will be eliminated from the queue.
How can I determine how many elements (i.e. strings) or commands are present in the array? The sizeof() function will not be helpful because the individual elements can be of different lengths.
Thanks in advance for your help or comments.

Just use a variable to store it... Which is the correct way to handle a buffer, i think...

You can't know how many items are in an array simply because an array has a fixed size, and there is no such thing as "not an entry".
The closest you can have is a fixed size array and only some entries in it are valid - those that aren't valid have a special value to say "this is not a valid entry". For char pointers it's normal to use NULL as the "not a valid entry" value.
The drawback of this approach though is that you can never store more items than there are slots for, and finding out how many valid or invalid entries there are and shuffling them around when you remove the first entry is both a tedious and time consuming task.
Better in this situation to use a circular buffer which is a fixed size array but you remove the concept of a "first" entry. Instead you have a "head" and a "tail" value which is the locations in the array where you read from (remove the oldest) and write to (add after the newest).  It's how the serial port on the Arduino deals with incoming and outgoing data - as data arrives it is added to a circular buffer and you then read from that buffer.
To help work with circular buffers I wrote a small template class:

https://github.com/MajenkoLibraries/CircularBuffer

Do you need to know how long the command queue is, or just if there are still elements in it? This seems like a case where you might be better off using a different data structure – a linked list seems like an obvious possibility. If you're not familiar with linked lists, this article may be helpful. Otherwise, I think you'll need to keep track of the number of elements in the queue for yourself.
If you do use an array, it will need to be declared with a fixed length, something like:
 char * CommandQueue[MAX_QUEUE_LENGTH];

The sizeof operator would tell you the length of the array, but not the number of items in it (the length of the array is the number of character pointers defined by MAX_QUEUE_LENGTH). The code to manage the command queue as an array could get pretty messy, especially if you need to execute the commands in order.
If instead you use a linked list then each command is added to the list at the end as it comes in, and when you execute commands they are pulled from the head of the list. If you need to know the length of the queue you could either update it as you add and remove commands, or you could iterate over the list and count the number of items in the list.

A very useful macro is membersof().
#define membersof(x) (sizeof(x) / sizeof(x[0]))

You will find in defined in large libraries and frameworks for C/C++. For your example above the number of elements is:
const int COMMAND_QUEUE_MAX = membersof(CommandQueue);
...
for (int i = 0; i < COMMAND_QUEUE_MAX; i++) ...

A dynamic set would require a max length and null terminated or simply a counter.
const int COMMAND_QUEUE_MAX = ...;
char* CommandQueue[COMMAND_QUEUE_MAX] = { ....., NULL };

for (char** cpp = CommandQueue; *cpp != NULL; cpp++) {
  char* name = *cp;
  ...
}

Or even better use a Queue data type:
Queue<char*, COMMAND_QUEUE_MAX> CommandQueue;
...
char* cp;
while (CommandQueue.dequeue(&cp)) ...

Cheers!


text:
Sending data over TCP connection in one piece
I'm trying to send short strings via Java client to Arduino server and vice versa. Sending data to client goes fine, but when I try to send data to arduino it cuts the string into bytes and then sends the first letter.  Will the following work?
for(int i = 0; i < data.length(); i++)

Even if it can be sent as characters I want to send it in one piece, because strings are very short so there should be no problems with length.
EDIT: Alright, I read client.read() documentation, so the problem is at arduino.
This is my java code:
public class TCP {
static Socket clientSocket;

public static void main(String args[]) throws Exception {
    clientSocket = new Socket("10.10.10.57", 5000);
    sendToServer("HAI THERE\n");
    String msg = getFromServer();
    System.out.println(msg);
    close();
}

static void sendToServer(String msg) throws Exception {
    //create output stream attached to socket
    PrintWriter outToServer = new PrintWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
    //send msg to server
    outToServer.print(msg + '\n');
    outToServer.flush();
}

static String getFromServer() throws Exception{
    //create input stream attached to socket
    InputStreamReader isr = new InputStreamReader(clientSocket.getInputStream());
    BufferedReader inFromServer = new BufferedReader(isr);
    //read line from server
    String res = inFromServer.readLine(); // if connection closes on server end, this throws java.net.SocketException
    return res;
}

static void close() throws IOException{
    clientSocket.close();
}
}

This code sends only one byte at the same time.It might be problem in my arduino code, since I read it with
char c = client.read()

One more thing. If there is any java master, I would like to know what to do with exceptions. How should I handle disconnected socket, failed connection to server, and so forth?

The problem is, that "char" is just one character. So you have to build your return out of the chars... if you want to use the "client.read()" function.
String res = ""; //this will be the resived msg after the loop
do {
   char c = client.read(); //c will be -1 if no byte is left
   if(c!=-1)
       strcat(res, String(c)); //Append the char to the result string
} while(c!=-1);

//Code is not tested!!!
To your java problem... just put your code parts into try catchs not whole functions (remove it for the function and add it on the points eclipse tell you to). So you can react to each error individually. Then put client stuff in a own thread so it not blocks any other stuff. Every disconnect or faild connection will throw an exception if you dont catch it with an if. So you have to handel it their (try to reconnect or something)
EDIT:
static void close() {
    try {
        client.close();
    } catch (IOException e) {
        system.out.println(e.toString()); //Print the error or do something else

    }
}

great, thank you, it should probably work! soooo, for example: static void close() throws IOException, I delete IOException, and do it in main method?

I put some example code in my answer above.


text:
Updated Arduino IDE and Arduino not working
I've had the 1.0.5 IDE on my PC, which worked great. Now I've just decided to update to 1.6.6. After some stupid Java errors and trial and error, I got it to work.
I recompiled my project. Massive errors. Fixed the errors and compiled again.
It stated "Uploading..." That took much longer than before, but I saw the "This takes xxx memory and xxx bytes on the device" yadi yadi ya.
I decided to unplug the Arduino, swap some jumpers and reconnect it (as I've always done). Only this time - I hear 3 beeps from my PC (the sound you hear with broken USB devices). The COM port is no longer recognized.
How do  I fix this? Did that IDE upgrade just brick my Arduino?

Have you tried switching it off and on again?

Lol, thanks. I might be on to something here though, hang on...

Allright, seems to be fixed. After a 3rd reinstall it seems like its fixed. I reinstalled the whole package, including the drivers, and now it seems to recognize the device again.
Also the compiling now stops properly when done and shows "upload complete".

Please accept your answer so that the question shows as resolved.  In the past we'd probably have just closed the question as "too localized" however that no longer seems to be an option, with the result that the question gets pointlessly churned up now and then.

Hey, sorry yeah I forgot about doing it. Its not possible to accept as a solution immediately, I had to wait a day or 2, but didn't put it in my calendar :) Thanks for the heads up.


text:
Documentation for creating a Board Manager profile for the Arduino IDE
I'd like to write a Board Manager profile for some Arduino boards that I have. So far I've struck out on finding the documentation on the format and contents of the files. Does anybody know where I can find it?

Documentation is kind of scarce.
Basically there are two aspects to what you want - the board definition and the board manager JSON file.
The first describes the board to both the IDE (entry in boards.txt) and to the API software (definition of what pins are what and what peripherals are where, etc).  The latter is in the file pins_arduino.h.
Then there is the JSON file that describes the whole package to the board manager and is what allows people to download the boards.txt and pins_arduino.h files (and anything else you may require) from your website.
As there is not much documentation you are best off taking an existing set of files that are close to what you want and modifying them.  Most of the time it will be a slight tweak such as re-ordering a few pins in some arrays, or changing the name of the board and maybe an upload command or baud rate setting.

Arduino has provided comprehensive official documentation. You may not have found it because, since this is developer documentation rather than something the average Arduino user needs, it is published in the wiki of the Arduino IDE GitHub repository rather than with the standard documentation on arduino.cc.
Hardware Package
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
Boards Manager Support Files

JSON Index File: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.6.x-package_index.json-format-specification
Boards Manager installation archive: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.6.x-package_index.json-format-specification#installation-archive-structure


text:
Best practise when dynamically updating sketch
I am currently working on a project that uses an Arduino Mega 2560 board along with the Arduino GSM shield to connect to the internet and send/receive SMS messages.
As part of my project, I want to be able to update the software that I am running dynamically. At a high level, I want to connect to my server, check if there is an update, if there is, download it and then overwrite the current sketch to run the new downloaded binary if the checksum of the downloaded binary is as expected (to avoid corruption).
Now, I am new to Arduino programming, so I figured I would ask a community of people with experience to determine the best method.
My current ideas are as follows:

Writing a custom bootloader - The sketch will have an update routine that downloads the new binary to a known location, and then performs a system reset. The bootloader will then overwrite the current sketch with the downloaded binary and then run the sketch.
Overwriting the sketch whilst running - I'm not sure of the viability of this method, but the overall method would be to write an update routine to the end of flash memory, and in this code simply overwrite all of the non-bootloader code with the new sketch.

Are these methods both viable, if so, is there one that would be preferable to another? If not, are there any known solutions to this problem?

The second solution looks like a second "bootloader" to me.. It's the best solution if you want to keep your arduino board "arduino compatible", otherwise the first one is the most clean

Possible duplicate of Updating the ARDuino code over GPRS

You won't be able to download the whole binary and test its checksum before flashing because RAM is so much smaller than flash. To do that, you'd need an external storage device to hold the new binary, and a custom bootloader to install it from the device.
Otherwise you'll have to load-and-flash, testing the checksum on the fly, and retry if you need to until you get a good reload. Can your device and its environment tolerate stopping for however long a couple of retry cycles might take? You can't recover if the process is interrupted once you start flashing; you can only move forward. Can it tolerate a conceivably long outage if communication goes down once the reload process has started?

Why could I not simply download the entire binary to external memory, calculate the checksum and then, if valid, copy it a word at a time to flash?

Depending on the size of the sketch, the Arduino Mega may have enough resources to hold your sketch in RAM, or else hold an extra copy in flash (perhaps not executable, if not linked for the holding address, but still hold).  Otherwise an external spi flash could be used.

@Shaktal - You could. That would be an instance of the example in my first paragraph. If adding an external memory device is acceptable to you, that would be an effective technique. You'd still need to provide a memory-device-to-flash boot-loader, but it solves the problem of getting a bad checksum or of losing communication during the download process, since you will not have to over-write any of the existing executable image until you have a complete and verified new one.


text:
Windows 10 problem installing driver
So the arduino shows up as "Unknown device" when connected to my computer. Followed somr guides on google but still failed, this error came up, what should I do? I've tried "Disable Driver Signature Enforcement" and the regedit thing..

Install the latest Arduino IDE with windows administrator rights.


text:
I don't have "Process" header
I'd like to run an application on my system after pushing a button on an Arduino shield. I've read that I need to use the runShellCommand() function, which can be accessed from a Process header. However when I add the #include <Process.h> line to my program I'm getting this error:
.build/uno/src/sketch.cpp:2:21: fatal error: Process.h: No such file or directory
 #include <Process.h>

I'm using Ubuntu 14.04 and I've installed Arduino software from repositories.

Whatever unspecified guide you are following is at minimum incomplete, and probably outdated too.  Note that nothing you do in an Arduino sketch on an Uno is going to run commands on a Linux box, without help of software/configuration on the Linux box to accept them.  It may be better to come up with a program on the Linux box which waits for specific serial output from the Arduino sketch and then performs a preset command or operation.

"It may be better to come up with a program on the Linux box which waits for specific serial output from the Arduino sketch "  Can you suggest me how to do that or direct me to some guide about that ? I really need this functionality

Learn how to accomplish serial communication and subprocess execution in the programming language of your choice.

That only works on an Arduino Yún (as described in this tutorial).


text:
Problems with Draw Loop using u8glib
I am using an Arduino Mega and a 12864ZW LCD with the u8glib library and the following code to draw to the LCD:
U8GLIB_ST7920_128X64 Display(LCD_E_PIN, LCD_RW_PIN, LCD_RS_PIN, U8G_PIN_NONE);

void loop(){
   Draw();
}

void Draw(){
   Display.firstPage();

   do{
      Display.setPrintPos(10, 10);
      Display.print("This is a test");
   }while(Display.nextPage());
}

The problem is that the display is constantly redrawing itself. When I used LCD displays in the past, they usually only required to write to the LCD once unless you wipe the display. When I adjusted the code to:
U8GLIB_ST7920_128X64 Display(LCD_E_PIN, LCD_RW_PIN, LCD_RS_PIN, U8G_PIN_NONE);
bool needsUpdate = true;

void loop(){
   Draw();
}

void Draw(){
   if (needsUpdate){
       Display.firstPage();
       do{
          Display.setPrintPos(10, 10);
          Display.print("This is a test");
       }while(Display.nextPage());
       needsUpdate = false;
   }
}

I do not get anything drawn on the LCD. Is there a parameter that needs to be set so I only have to redraw the LCD if something changes? Am I using an outdated library? Is there a better library I should be using?
EDIT
I think the main problem I have with using this library is does the Draw loop need to be executed continuously to display on the LCD or is there a way to only draw the screen once until it is needed to be drawn again?

You haven't shown us all the code – in particular, the call to Draw() from loop() is missing – so this answer is speculative, based on the assumption your loop() is as follows.
void loop(void) {
    Draw();
}

If so, your first bit of code will constantly redraw because loop() runs repeatedly without delay.  Try adding a delay(1000); after Draw() in that case.
Your second bit of code will begin by drawing your image once, and in that Draw() call it will set needsUpdate to false.  Then loop() runs again, and the firstPage() call erases the screen.  Since needsUpdate now is false and remains false, subsequent calls don't draw an image.
Rather than putting your picture loop into Draw(), perhaps use Draw() just to draw primitives, and keep your controls in loop():
void loop(void) {
  Display.firstPage();
  do {     // picture loop
    Draw();
  } while( Display.nextPage() );
  delay(1000); // delay before next picture
}

If you still get repeated fast redraws, for troubleshooting comment out the do and } while lines.

Thanks for the answer, I updated my question with the missing bits and also changed where the firstPage is located but still getting the same results. I tried commenting out the while loop when I do nothing gets drawn.

@AndyBraham, does thelloworld work ok (changed to use your own constructor) ?  If so you may need to add font selection, eg  Display.setFont(u8g_font_unifont);, in your own Draw, and/or drawStr vs print

Yes the Helloworld example you gave works fine. I guess my main hangup is that the LCD has to have a loop going all the time instead of only when things need updating and how long the Display takes to redraw each time. Seems to me that it is requiring allot of time to refresh the screen if it has much to draw. I will eventually have some highlight functionality that will be driven from Buttons and I am trying to figure out how the lcd code should work. As it is performing now the Draw is taking so much time that any inputs won't be caught.

@AndyBraham, you might be able to just call nextPage() after each Draw() call (to tell u8g drawing is done) and ignore its output [1 or 0 as another Draw is needed or not].  I haven't looked closely but imagine nextPage() is supposed to test whether new objects being drawn have made a write-from-scratch necessary.  If you already know that from how you update the image, just ignore output of  nextPage().  Re inputs, use PCI's, pin-change-interrupts, which can happen and probably can be handled during drawing.

Thanks a bunch! You got me on the right track, I posted an answer on here that shows the correct way (I feel) that this should be done.

Much thanks to jwpat7 for getting me on the right track with this. So I found out how this LCD should really be setup. I am not sure why the examples I was able to find online and even on the u8glib wiki showed the usage like my question but I was able to get this library functioning right.
First thing is the .firstPage() and .nextPage() functions. The .firstPage() function actually clears the screen and the .nextPage() function displays what is waiting in the queue (thanks jwpat7). When the .nextPage() finishes there is no need to write to the LCD again until you need a refresh. I put together a very simple code example that uses a input to change the text without having to continuously update the LCD.
U8GLIB_ST7920_128X64 Display(LCD_E_PIN, LCD_RW_PIN, LCD_RS_PIN, U8G_PIN_NONE);
bool redraw = true;
String strOut = "This is a test...";

void loop() {

    if (redraw){
        Display.firstPage();  //Clear the LCD

        //Main Difference while the LCD needs drawing will return 1
        while(Display.nextPage()){
            Display.setFont(u8g_font_04b_03b);
            Display.setPrintPos(20, 20);
            Display.print(strOut);
        }

        redraw = false;  //Clear flag to redraw
    }

    //check if any of the pins in PINA have been pressed
    if (~PINA & 0xff){
        strOut = "Of the emergency broadcast ...";

        redraw = true; //Set flag to redraw the screen
    }
}


text:
Multiple RGB LEDs
I'm quite new to these things and I need some help. I'm building a computer shelf with plexiglass and RGB LEDs (one per length) and I need some help to sketch up a data sheet of some sort for this.
I'm thinking of using an Arduino Uno, but will it be able to run 12+ LEDs?

A key piece of information is how many is "12+ leds"? Is it 13, 14, 100? Without that it is quite hard to give advice? What do you want to do that a cheap, off-the-shelf, RGB LED controller can't do?

Well basicly what I'm hoping for is to control two shelves with led which then means 12x2. As mentioned I'm very inexperienced with this so I though it would be the better solution to use a arduino. Do you have any other recommendations instead?

Just get some rgb-led-strips. Connect them to and Arduino using some mosfets.

If all you want is some lighting effects, then I'd suggest some LED strips with controller and remote control from one of the well-known e-stores. You can get a power-supply, remote control and RGB LEDs at a reasonable cost. For 24 LEDs, you'll need a separate power supply anyway; the Arduino isn't enough. If what you want to do is learn about Arduino, I'd recommend jwpat7's advice. Try to get some Ws2812b RGB LEDs on a strip, and a power supply, and experiment with Adafruit's NeoPixel library

@Green, imho, there are millions of projects/tutorials on this, which are often much more detailed.

If your RGB LEDs are WS2812-style, 5050-size units, it is no problem to control dozens of them using an Arduino Uno or several other models of Arduinos.  [For ATtiny systems, other libraries than Adafruit's NeoPixel may be needed; the NeoPixel library keeps several bytes of state data per pixel, which some other libs don't.]
WS2812-style LEDs typically are arranged in serial strings, driven by a single IO pin from an Arduino.
If you have more than half a dozen WS2812s in the string, power for them should come from an external power supply, rather than via an Arduino's built-in 5V regulator.
For more information, see related questions like Arduino with WS2812 using Adafruit NeoPixel library fade in/out different patterns, and Arduino and WS2812 RGB LED Strip "freezing", and  fading colors on a ws2812 strip; also see Google search Arduino Stackexchange for WS2812.


text:
Error opening serial port 'COM1'. (Port busy)
Im using the arduino Micro pro to read the data out of a temperature sensor (lm35). The program is compiling and NOT uploading, but when I try and open the serial monitor is says: Error opening serial port 'COM1'. (Port busy)

To be able to help you it would really help to know your development environment (what OS are you working on, how are you connecting to the serial port, etc.). The message suggests that another process using the serial port, it could be as simple as need to close and reopen your terminal emulator.

Im using windows 8.1, and im connecting to the serial port via usb.

How are you connecting to the serial port (what software are you using to received the serial data)? I don't do much with Windows, but I think the problem that you're having is that your terminal emulator is expecting to see the data on your COM1 port but you're actually transmitting the data over USB and a virtual serial port. The serial monitor in the Arduino IDE picks up the serial port from the setting in the menu Tools > Port (which is also used for your upload), but other programs will need it to be explicitly set.

the software is built in the arduino IDE. I edited the post the code is not uploading, only compiling.

COM1 is usually reserved for the built in serial port in the computer. Your USB serial port is more likely going to be COM3 or COM11, or even COM23 rather than COM1.  Make absolutely sure you have the right COM port selected, and that you have installed the right serial drivers for your board.

I used this to download my driver and install it  https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/installing-windows

On OS X you could check by looking at the USB devices found in the system configuration or the serial devices found in /dev – I pretty sure there is something similar in Windows 8, but it has been so long since I've used Windows that I can't remember what it is called. On OS X the IDE lists the devices that it has found, so I'd start there. If you only see COM1 then it is a good bet that you don't have the necessary USB serial drivers installed.

i tried using different coms
im getting this error: avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x5a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x5a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x5a
Problem uploading to board.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x5a

I've got an idea. Your board isn't being recognized. Try unplugging the arduino and see if Com 1 is still there. Sometimes it can recognize mice and other devices as Com 1 or 2 instead of your arduino.
On some of my development machines after everything settled out my devices will show up on Com 4 and 5 when I am working on two at a time.
If this is not the case go into the device manager and see if you can see the board listed.
I would also wonder if you have your sensor hooked to digital pins 0 and 1. These pins are used for your serial line on usb. So if you have anything such as a sensor hooked to them it may be generating data keeping the line busy instead of it being able to negotiate.
I had this happen when setting up hc-05 for the first time. I realized I had to keep the chip off while flashing or I would end up with errors or Com busy.
Please provide your pinout and basic information about the Com ports available on the ide. Also consider that you will need to specify the correct board as it will default to an uno.
Programmer not in sync issues generally occur because the board is recognized but cannot be written to for one reason or another.

the board has something plugged into digital 1 and 0 which are serial i/o pins
the board programmer is busy running your last batch of code
usb error

So

try a different cord
try unplugging potential wiring issues and see if it can be written to without anything on it
try holding down reset on the board until the board when you try to write to it until just after it finishes compiling to clear any potential programing issues

In my experience mega have a tendency to suffer from the last one.

Simple solution:
Close the arduino application and start again.
if still the issue persist restart your system. :)

I had a similar issue (port busy, RN42+Win 8.1) and find a solution by changing the usb bluetooth dongle of the computer.
The one which finally works for me was the Adafruit Bluetooth 4.0 USB Module (v2.1 Back-Compatible).


text:
How does this eBay relay board connect to the Arduino
I bought a single channel relay on eBay and besides the NC/COM/NO, it has six pins and a jumper.

It is not possible to see the labels on the image, but the labels are:
X  X--X  X  X  X
VCC   -IN+   GND

The default jumper position is shown above with a - mark.
Which pins should I use for VCC, GND and ARDUINO? Is the jumper on the correct position?

Your module consists of both an optocoupler (large black rectangular device) and a P-channel MOSFET driver circuit for the relay.
VCC and GND are used to power the MOSFET and relay, and so should be connected to a power source suitable for driving the relay (if it's a 5V relay then the +5V and GND pins of the Arduino - if it's a 12V relay then a 12V power supply).
The interface to the Arduino is through the optocoupler. The Arduino sees that as just an LED, so you can wire it up just like any other LED.  The circuit contains a current limiting resistor already, so you don't need to worry about that at all.  So you connect the - of the input to GND and the + to an IO pin, or connect the + to +5V and the - to the IO pin, depending on which polarity of drive you want to have.
The jumper is optional to allow you to create one of those two links on the board - say connecting - to GND or connecting + to VCC so you don't need the extra wire.

I tried it and I was able to control the relay (there is a led to indicate the relay state), but the relay itself apparently didn't active (no sound) and the NC/COM didn't switch to COM/NO. Is this a faulty relay?

It may be, but unlikely. Be sure that you are providing the right voltage to VCC.

You should do a bit of testing. The Vcc and GND pins will go to power and ground respectively. They are powering the circuitry on the board that protects the Arduino from the relay coil. Then it looks like the IN pins allow you to operate the relay either from an active high or an active low signal.
If you have a DMM check the connections of the pins (see if any of them are common). The thing that is puzzling to me is the jumper, but it may be set up so that you can use only two wires to control the relay by using the IN terminal to also supply either Vcc or ground.
So start out by hooking up to power and ground, and then test by jumping the IN pins to ground and power in turn. I would expect the relay to operate when the IN+ goes to Vcc or when the IN- goes to GND.

The two VCC pins and the two GND pins are common. I was able to control it with the other answer.