message:
Arduino Ethernet Client crashes after obtaining values from string

My Ethernet server keeps crashing after pulling the RGB values from the string. It remains connected if I'm just toggling a pin, but whenever the string has the rgb values in it, the RGB values are pulled, the LED changes but then the server crashes and won't take any more requests. Do I need to restart the server after it plucks the RGB values for another read? If so, how would I go about doing this?

Thanks, James :)

Example HTTP request that causes the crash: /?LED=B233+G011+R133&t=T HTTP/1.1

        #include <SPI.h>
        #include <Ethernet.h>
        #include <string.h>

        byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
        byte ip[] = {192, 168, 0, 102 };
        byte gateway[] = {192, 168, 0, 1 };
        byte subnet[] = {255, 255, 255, 0 };
        EthernetServer server(84);
        ;

        char* redstring={0};
        String blue1;
        String green1;
        String red1;
        String testString = "0123456789";

        int blue;
        int green;
        int red;
        int been=0;
        int b=0;
        int g=0;
        int r=0;
        //////////////////////

        void setup(){

        pinMode(11, OUTPUT);
        pinMode(9, OUTPUT);
        pinMode(7, OUTPUT);
        pinMode(6, OUTPUT);

        //start Ethernet
        Ethernet.begin(mac, ip, gateway, subnet);
        server.begin();

        //enable serial data print
        Serial.begin(9600);
        Serial.println("SERVER RUNNING HTTP / GET");
        }

        void loop(){
         ////////////////////////////////////////
         EthernetClient client = server.available();
    if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (sizeof(redstring) < 100) {

          //store characters to string
          redstring += c;
          //Serial.print(c);
        }

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////////////////////////////////

          Serial.println(redstring);

          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("");
          client.println("<link rel=\"shortcut icon\" href=\"data:image/x-icon;,\" type=\"image/x-icon\">");
          client.println("");
          client.println("<TITLE>Arduino GET</TITLE>");
          client.println("");
          client.println("");

          client.println("
HTML GET
");
          //change ip back if not local
          client.println("<FORM ACTION=\"http://192.168.0.102:84\" method=get >");

          client.println("JQUERY: <INPUT TYPE=TEXT NAME=\"LED\" VALUE=\"\" SIZE=\"25\" MAXLENGTH=\"50\">
");

          client.println("<INPUT TYPE=SUBMIT NAME=\"t\" VALUE=\"T\">");

          client.println("</FORM>");

          client.println("
");

          client.println("");
          client.println("");

          delay(1);
          //stopping client
          client.stop();
          /////////////////////
          //readString = Character.toUpperCase(readString);
          for (int i = 1; i < sizeof(redstring); i++) {
            if (strchr(redstring, 'B') && && redstring[i+1] > -1) {
              blue=redstring[i+1, i+4];
              analogWrite(11, blue);
              delay(1000);
                          }

            if (strchr(redstring, 'G') && redstring[i+1] > -1) {
              green=redstring[i+1, i+4];
              analogWrite(9, green);
              delay(1000);
                          }

            if (strchr(redstring, 'R')&& redstring[i+1] > -1) {
              red=redstring[i+1, i+4];
              analogWrite(7, red);
              delay(1000);
                          }

          }

          //clearing string for next read
               redstring="";
              (redstring, "0", sizeof(redstring));
            }
          }
        }
      }
    }

body:
Using `String`, which uses dynamic allocation/deallocation on the heap is not advised in embedded platforms, as this can quickly lead to heap fragmentation, eventually leading to memory exhaustion, heap/stack collision...

First off, you should try to replace all `String` usage, everywhere in your program, with C-tyle strings, i.e. `char*` or `char xxx[...]` along with dedicated C functions to deal with them: `strchr`, `strstr`, `strcpy`, `strcat`, `strtok`, `atoi`...

Second, you can avoid using global variables and use the stack for many of them.

    void loop() {
        ...
        if (client) {
            char readString[101];
            const int READ_STRING_SIZE = sizeof(readString) - 1;
            int readIndex = 0;
            while (client.connected()) {
                if (client.available()) {
                    char c = client.read();
                    if (readIndex < READ_STRING_SIZE) {
                        readString[readIndex++] = c;
                    }

                    if (c == '\n') {
                        // Terminate the read string
                        readString[readIndex] = 0;
                        Serial.println(readString);

                        // Prepare for next reeading
                        readIndex = 0;

                        client.println("HTTP/1.1 200 OK");
                        ...
                        client.stop();

                        // convert readString to all uppercase
                        for (i = 0; i < strlen(readString); i++)
                            readString[i] = toupper(readString[i]);

                        bool b = false;
                        bool r = false;
                        bool g = false;
                        int blue, red, green;

                        // Look for 'B' value
                        char* bb = strchr(readString, 'B');
                        if (bb != 0 && isdigit(bb[1]) {
                            blue = atoi(&bb[1]);
                            analogWrite(11, blue);
                            delay(500);
                            b = true;
                        }
                        // Same for 'G' and 'R' value
                        ...
                        if (b && r && g) {
                            Serial.print("CHANGING RED TO: ");
                            Serial.println(red);
                            Serial.print("CHANGING GREEN TO: ");
                            Serial.println(green);
                            Serial.print("CHANGING BLUE TO: ");
                            Serial.println(blue);
                        }
                    }

                    if (strstr(readString, "PIN6") != 0) {
                        digitalWrite(6, !digitalRead(6));
                        ...
                    }
                }
            }
        }
    }

In this sample code, we have completely removed dynamic memory allocation.


sender: user

message:
bitRead() gives wrong answer Arduino UNO R3

I am trying to read from a quadrature rotary encoder using an Arduino UNO R3. This is done by connecting the encoder's channel A pin to the Arduino interrupt 0 pin (digital IO pin 2). Inside the interrupt routine I then read the value of channel B (connected to digital IO pin 8) to determine the direction of rotation.

I am able to read the correct value of channel B using the digitalRead() function, but when I use bitRead() it always gives me a 0. As far as I know digital IO pin 8 is mapped to PORTB bit 0, so I am using bitRead(PORTB, 0) to read the bit. I also tried to read all of the other pins, but all of them show 0, except the LED at pin 13, which shows 0s and 1s when it gets toggled (It is also the only pin defined to be an OUTPUT pin, whereas the encoder uses INPUT pins).

Below is my code:

    int channelA = 0;
    int channelB = 8;
    volatile int rotateNumber = 0;
    volatile boolean interrupted = false;

    void setup() {

        Serial.begin(115200);

        attachInterrupt(channelA, rotate, RISING);
        pinMode(channelB, INPUT);
    }

    void loop() {
       if(interrupted){
           Serial.println(rotateNumber)
           interrupted = false;
       }
    }

    void rotate(){
      if(bitRead(PORTB, 0) == 1)
         rotateNumber++;
      else
         rotateNumber--;

      interrupted = true;
    }

sender: assistant

body: `PORTx` is the latched value last written there. The external value is found in `PINx`.


message:
How can I run two loops simultaneously on an Arduino Uno?

I'm new to Arduino and I have two devices that I'm trying to control:

1. A RGB LED light strip that can change colors
2. A light sensor that can detect the ambient light level

What I'd like to do is have the LED strip continuously cycle through a rainbow of colors, and the light sensor will adjust the brightness of the LED strip based on the ambient light level. Here are the two pieces of code by themselves, which I've tested in isolation and confirmed that they work properly:

LED strip:

    j = (j + 1) % 256; // current iteration of the light cycle

    // set the strip color
    for(int i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }

    // display the new colors and wait 20ms before the next cycle
    strip.show();
    delay(20);

Light sensor:

    sensors_event_t event;
    tsl.getEvent(&event); // get a light measurement
    strip.setBrightness(event.light); // set the brightness of the LED strip

The problem is that the light sensor takes anywhere from 100ms to 600ms to get a reading, and `tsl.getEvent(&event)` is a blocking call, so the end result is that the LED strip updates way too slowly. I would need to run the two side by side so that the light sensor read does not block the LED strip update. Any idea how I can accomplish this?

body:
Setup a 'state server' in your loop(). Put simply this means keeping track of the next command for each task, then doing one thing in each task per loop().

If one task needs to run at a faster speed than another task you can use a timer in your loop to decide what to do next.

If a task needs a pause then save the "Last Run" millis() to a global variable and ignore the task until the correct amount of time has passed. Do not use a delay(), always let the loop() run.

The idea is that the loop() runs as often as possible but you do one thing each time it runs.

It takes a while to get the hang of this way of working but it leaves the Arduino processor free to process all jobs evenly.

    int task1Status=0;
    int task2Status=0;

    void loop()
    {
      doOneThingOfTask1();
      doOneThingOfTask2();
    }

    //10 things to light the leds, but only do one
    void doOneThingOfTask1()
    {
      if (task1Status==10)
        task1Status=0;

      switch (task1Status)
      {
        case 0:
           //start doing a new process

        case 1:
           //do something

        case 9:
           //do the last thing

      }
    }


body:
The arduino is not a multithreaded or multi-tasking device. You have to write your different functions to "play nice" with each other. Blocking code is death for this sort of multitasking. You might need to rewrite your code that reads the light sensor to be non-blocking.

If you can get that code to be non blocking then Visual Micro's post is the way to go.


body:
You can make the sensor return data faster by lowering it's accuracy.

    tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS);      /* fast but low resolution */

You can also modify the library to not power-down the sensor after each reading. Just open `TSL2561.cpp`, find the `getFullLuminosity` function, and comment out the line reading `disable();` and the 12 lines reading `switch (_integration){ ... }`

Another solution is, to have the pixels update every 20ms using a [timer](http://playground.arduino.cc/code/timer1). You can have the timer, interrupt the main loop every 20ms and update the pixel values.

(I can't really help you with timers, as I myself set the registers for my timers, and ISRs directly, which isn't for beginners. But there are probably libraries for it, to make it more user friendly.)


body:
Your first, biggest problem is
> the light sensor takes anywhere from 100ms to 600ms to get a reading, and tsl.getEvent(&event) is a blocking call,

You need non-blocking access to the light sensor. Look at the library code to see what it is doing when it blocks. Chances are it waits for the sensor to set a 'done' bit. If so, you'll need to modify the library, either by

 1. adding a boolean `.isDone()` function that tests the done bit, and don't let your main program call for a reading until isDone() == TRUE; or
 2. making .getEvent() a non-blocking such that it immediately returns an obviously invalid reading (such as -1) instead of blocking if the sensor isn't ready yet.

That leaves your main program free to service whatever needs doing and is ready to do without holding up everything for the slow sensor.


body:
There are libraries that allow multitasking, for instance my library [arduOS][1].

This should work:

    #include <arduos16.h>
    #include <arduos_core.h>
    #include <roundscheduler.h>

    SYS_enable_preemptive; // do NOT forget this!!!
    void setup()
    {
        auto sched = new SYS::RoundScheduler(2);
        sched->add(&loop1); // those 2 are functions.
        sched->add(&loop2);
        SYS::start();
    }

But keep in mind that actual multitasking can be rather tricky, with very obscure bugs. (but you can find them).

  [1]: https://launchpad.net/arduos


body:
 1.Use two arduino's and have them talk to each other via serial or i2c.
Probably the simplest option (but not the cheapest - though you can get clone arduinos from US$4 ).

2.Find a light sensor that updates faster. Tried an ldr(light dependent resistor)/photocell ?  Then could use analog read.

Could also switch from using arduino to c, but thats a lot more work and you are still going to hit similar problems.


message:
Is `millis()` affected by long ISRs?

I have a project that uses timers and interrupts frequently. A lot of CPU time is spent handling ISRs over an extended period of time.

Would this affect code inside the main loop that relies on the millis() function since a significant amount of time is spent processing the ISRs?

body:
After some digging around in the core, it seems like Arduino updates `millis()` with a 8 bit timer: it uses overflow with a prescaler value of 64. In simpler terms, it has it set up so a certain piece of code (the ISR) is run approximately once per millisecond on a 16MHz system (and proportionately less frequently on slower clocked systems).

When that ISR is ran, it increments a variable that is used by the `millis()` function.

So, even if some non-interruptable code is being ran for a fraction of a millisecond, it won't matter since the bit for that interrupt vector will still remain set.

However, there is a problem when the ISR is ran less often than it should be triggered. This may be a result of using `noInterrupts()` for an extended period of time or when too many other interrupts are being ran and there is not enough CPU for all of the tasks. If a lot of the other ISRs have a higher *interrupt priorities*, it is possible that the code for the `millis()` may never be ran. In this case, you would have more serious issues than this, but it is something to keep in mind when you're writing code.

The general rule of thumb of ISRs still apply: **keep it short!!!**

Note: if you require extreme accuracy, the built in function isn't the best choice. A RTC is a good idea for long term time keeping.


body:
ABSOLUTELY

any ISR that is long will prevent millis() from incrementing. It can be dubiously slow skew of this clock.

The ISR function always start off with blocking interrupts with the cli() command at start and finish by enabling them with the sei() command. Blocking other ISR's along with Timer0's OverFlow interrupt which is used for increamenting the millis counter.

Any extended use of noInterrupts() or cli() or implied use with ISR's should be carefully short in duration. There is no general harm in executing either of interrupts() or sei() with in the ISR, as to allow interrupts again.

Example:

in the VS1053 library I have Data Request on an INT pin. Which's ISR may read from the SdCard, which can take a very long time. So I re-enable the interrupts() before reading the SdCard, but still in the ISR.


body:
> Would this affect code inside the main loop that relies on the millis() function since a significant amount of time is spent processing the ISRs?

To put a figure on it for you ...

---

## Frequency of the Timer 0 overflow ISR being called

The code called by the (default) Timer 0 overflow interrupt vector (TIM0_OVF_vect) is used by `millis` and `micros` to help return their results. Its purpose is to count Timer 0 overflows.

To get accurate results this ISR must not miss an overflow. The timer is configured to **tick** every 4 µs on a 16 MHz system (because of the prescaler of 64: `64 * 62.5 ns = 4000 ns`) and **overflow** every 1.024 ms (1024 µs) - because it overflows after 256 ticks ( `4 µs * 256 = 1024 µs` ).

Since there is only one overflow flag, if the ISR misses an overflow then both millis and micros will be out by 1.024 ms (or more, if it misses multiple overflows).

To be certain of catching that overflow, the ISR therefore has to be called within 1.024 ms (probably slightly less because of the time taken to enter the ISR, so say: 1 ms).

---

## Interrupt priority

On the Atmega328P (such as used in the Arduino Uno) these are the interrupt vector priorities:

     1  Reset
     2  External Interrupt Request 0  (pin D2)          (INT0_vect)
     3  External Interrupt Request 1  (pin D3)          (INT1_vect)
     4  Pin Change Interrupt Request 0 (pins D8 to D13) (PCINT0_vect)
     5  Pin Change Interrupt Request 1 (pins A0 to A5)  (PCINT1_vect)
     6  Pin Change Interrupt Request 2 (pins D0 to D7)  (PCINT2_vect)
     7  Watchdog Time-out Interrupt                     (WDT_vect)
     8  Timer/Counter2 Compare Match A                  (TIMER2_COMPA_vect)
     9  Timer/Counter2 Compare Match B                  (TIMER2_COMPB_vect)
    10  Timer/Counter2 Overflow                         (TIMER2_OVF_vect)
    11  Timer/Counter1 Capture Event                    (TIMER1_CAPT_vect)
    12  Timer/Counter1 Compare Match A                  (TIMER1_COMPA_vect)
    13  Timer/Counter1 Compare Match B                  (TIMER1_COMPB_vect)
    14  Timer/Counter1 Overflow                         (TIMER1_OVF_vect)
    15  Timer/Counter0 Compare Match A                  (TIMER0_COMPA_vect)
    16  Timer/Counter0 Compare Match B                  (TIMER0_COMPB_vect)
    17  Timer/Counter0 Overflow                         (TIMER0_OVF_vect)
    18  SPI Serial Transfer Complete                    (SPI_STC_vect)
    19  USART Rx Complete                               (USART_RX_vect)
    20  USART, Data Register Empty                      (USART_UDRE_vect)
    21  USART, Tx Complete                              (USART_TX_vect)
    22  ADC Conversion Complete                         (ADC_vect)
    23  EEPROM Ready                                    (EE_READY_vect)
    24  Analog Comparator                               (ANALOG_COMP_vect)
    25  2-wire Serial Interface  (I2C)                  (TWI_vect)
    26  Store Program Memory Ready                      (SPM_READY_vect)

You can see from that list that TIMER0_OVF_vect is number 17 on that list, so any earlier priority interrupt would take precedence, for example external interrupts, pin change interrupts, the other timers (however not SPI / Serial / ADC / I2C).

If an overflow had **just happened** then you would have practically 2 ms of grace (because you have 1 ms before the next and then another 1 ms before you need to notice it). However if the overflow is **about to happen** then you only have the 1 ms grace period.

I mention this because if you have an external interrupt 0 event (INT0_vect) and the ISR takes 500 µs, and then external interrupt 1 event (INT1_vect) during that time (so another ISR will be serviced) then the timer interrupt might be blocked for a while.

That is why **all** ISRs should be short. It isn't good enough that some of them are.

---

## Re-enabling interrupts

I strongly recommend **against** this. The libraries are not designed to be re-entrant, and once you start enabling interrupts in one ISR you may find that it itself is called again when it is half-way through being called the first time. You may also conceivably interrupt a library function (eg. memcpy) that was not designed for it.

And, of course, if you are re-enabling interrupts inside an ISR **because** the ISR takes a long time: well, that is the exact situation when you may trigger this re-entrancy.

---

## More information:

* [Interrupts](http://www.gammon.com.au/interrupts)
* [Timers](http://www.gammon.com.au/timers)
* [Millis overflow](http://www.gammon.com.au/millis)


body:
The timer interrupt can even disrupt measurement of pulses using micros() from an on change interrupt.  The timer interrupt takes around 6.5us on Arduino Uno or mega.  If a change interrupt takes place just after the timer interrupt, then the change interrupt will be delayed by up to 6.5us until the timer interrupt completes.  In addition, the microsecond count is only updated once every 4us, introducing further uncertainty up to 4us.

So the measurement may be up to 10.5us out.  This should be considered when measuring pulse lengths.


message:
Creating a product with arduino bootloader

If you have a prototype with arduino and you wish to create a real product can you do it or the fact that it contains the arduino bootloader prevents you?

BTW, i dont have a product ready. I am thinking options though. Or maybe i will have to go find a job

body:
A quick google search found [this info on the Arduino Forum](http://forum.arduino.cc/index.php?topic=104149.0) which a user kindly shows the rules relating to this stuff.

The Optiboot bootloader is not actually an Arduino 'product'. Boards you design and software you write using Arduino IDE and libraries does not need to be disclosed to anybody, other than having the objects available (probably in a hidden part of your product's support website, in a "firmware" sub section) for some reason relating to being able to build the source against newer versions of Arduino.

I am currently making a product which I intend to use Arduino libraries and IDE and bootloader for fast development, but the board, schematics, and essentially the application code except for the libraries from Arduino will be mine. If you copy or build stuff specifically for/from Arduino hardware, you must(?) release certain source/schematics etc.


message:
A good place to begin with Arduino?

So I bought the Arduino starter kit a few weeks ago and I've done a few of the projects in the book supplied with the set. Unfortunately the book is quite poor, with inaccurate explanations and sometimes no explanation behind what they want you to do in the projects.

So I'd like to know what people would reccomend? I found 2 well reviewed books; Arduino for Dummies and Arduino Workshop, but I'm torn which to take. So I'm asking in here in hope that I can save time and money on buying and reading a good book from the start.

I'm a programmer by profession and also know a bit of physics, but have little experience with electronics.

body:
I have read a lot of materials, watched many videos and completed lots of searching to find great stater Arduino lessons. By far the best place I found was

opensourcehardwaregroup.com
[Free to start learning Arduino site][1]

Free initial course and if you like the lessons you can pay a small fee to get to the advanced course. You will learn a lot!

  [1]: http://opensourcehardwaregroup.com


message:
Using an Arduino for learning embedded C programming

I'm a computer systems engineering student and was planning to buy an Arduino to learn embedded C programming. After researching I found mention that an Arduino may not be a good choice for a beginner that wants to learn about programming embedded systems using C.

I'm not sure if that is true, can an Arduino be programmed in C without using C++ and the other included class libraries? I'd prefer to learn how to program things at a fairly low level and not rely on libraries that hide details of the underlying hardware. Can the Arduino be used as a general AVR / microcontroller development platform to learn embedded C programming?

body:
The Arduino is a great place to start embedded C programming. You can use both C and CPP. There are tons of tutorials online and there are a bunch of books available. In addition there are lots of libraries available on GIT HUB for interfacing with all types of hardware like RF24 Wireless Transceivers.

If you want to go into more low level programming, you can. For example, you can set all Port B pins to Output:

    // the setup routine runs once when you press reset:
    void setup() {

      // initialize the digital pins as an output.
      DDRB = 0xff;
    }


body:
[Not sure who's listening, as this is a 4 year old question posted by someone who no longer seems to have an account here, but... ]

> ... can an Arduino be programmed in C
> without using C++ and the other included class libraries?

You absolutely can use either C or C++, and make use of class libraries or write your own functions for either or both of computing tasks and managing your external hardware.

> Can the
> Arduino be used as a general AVR / microcontroller development
> platform to learn embedded C programming?

Yes, for the reasons above, and more. Embedded systems differ from other computing systems by having deadlines the must meet. These can be soft deadlines (try to keep visible delays to a minimum so you don't annoy the user/operator) or hard deadlines (if you miss one, something could fail or someone might die). They come in different scales: my home thermostat could be capably run by an Attiny "with one pin tied behind its back". :) Other systems might contain many large-scale chips or a mix of both, networked internally to one another. A mid-scale example of this is an automobile engine controller. It runs your signals, entertainment system, ABS brakes and traction control, and more, all while opening and closing injector valves and firing spark plugs with precise timings, at up to 125 times per second. And that is for a pretty normal, family-car, "street" engine.

The Atmega328p (Uno's MCU) is sufficiently over-engineered to tolerate occasional misuse, being over-clocked or supplied a lower than spec'd voltage, has several ways to update/replace its program, is easy to hand-build into a custom micro-controller board, and after all that abuse, is cheap enough to replace if you do manage to damage one.

Documentation is readily available as are online communities like this one, to help with beginners questions, unusual questions, esoteric uses that maybe only a handful of people have tried or know about.

So, tl;dr: yes, I'd call it an ideal platform for everything you asked about.


message:
Getting a long avrdude error while uploading a simple sketch to arduino uno

This is the error which shows up after the sketch is compiled and starts uploading.

Is there some sort of fix to this problem?

There are no shields connected to it, not even I/O pins are being used, just trying the simple Blink sketch.

NOTE : It was working find before and then it started acting crazy

        Binary sketch size: 1,084 bytes (of a 32,256 byte maximum)
    C:\Program Files (x86)\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM3 -b115200 -D -Uflash:w:G:\Temp\build5658632448223358877.tmp\Blink.cpp.hex:i

    avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2009 Joerg Wunsch

             System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

             Using Port                    : \\.\COM3
             Using Programmer              : arduino
             Overriding Baud Rate          : 115200
    avrdude: Send: 0 [30]   [20]
    avrdude: Send: 0 [30]   [20]
    avrdude: Send: 0 [30]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
             AVR Part                      : ATMEGA328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             serial program mode           : yes
             parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             ByteDelay                     : 0
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :

                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

             Programmer Type : Arduino
             Description     : Arduino
    avrdude: Send: A [41] . [80]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [03]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [81]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [04]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [82]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [04]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [98]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [03]
    avrdude: Recv: . [10]
             Hardware Version: 3
             Firmware Version: 4.4
    avrdude: Send: A [41] . [84]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [03]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [85]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [03]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [86]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [03]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [87]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [03]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [89]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [03]
    avrdude: Recv: . [10]
             Vtarget         : 0.3 V
             Varef           : 0.3 V
             Oscillator      : 28.800 kHz
             SCK period      : 3.3 us

    avrdude: Send: A [41] . [81]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [04]
    avrdude: Recv: . [10]
    avrdude: Send: A [41] . [82]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [04]
    avrdude: Recv: . [10]
    avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: P [50]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: AVR device initialized and ready to accept instructions

    Reading | avrdude: Send: u [75]   [20]
    avrdude: Recv: . [14] . [1e] . [95] . [0f] . [10]
    ################################################## | 100% 0.00s

    avrdude: Device signature = 0x1e950f
    avrdude: Send: V [56] . [a0] . [03] . [fc] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [00]
    avrdude: Recv: . [10]
    avrdude: Send: V [56] . [a0] . [03] . [fd] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [00]
    avrdude: Recv: . [10]
    avrdude: Send: V [56] . [a0] . [03] . [fe] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [00]
    avrdude: Recv: . [10]
    avrdude: Send: V [56] . [a0] . [03] . [ff] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [00]
    avrdude: Recv: . [10]
    avrdude: reading input file "G:\Temp\build5658632448223358877.tmp\Blink.cpp.hex"
    avrdude: writing flash (1084 bytes):

    Writing | avrdude: Send: U [55] . [00] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] . [0c] . [94] a [61] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] . [9d] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [00] . [00] . [00] . [00] $ [24] . [00] ' [27] . [00] * [2a] . [00] . [00] . [00] . [00] . [00] % [25] . [00] ( [28] . [00] + [2b] . [00] . [00] . [00] . [00] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    #####avrdude: Send: U [55] @ [40] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] # [23] . [00] & [26] . [00] ) [29] . [00] . [04] . [04] . [04] . [04] . [04] . [04] . [04] . [04] . [02] . [02] . [02] . [02] . [02] . [02] . [03] . [03] . [03] . [03] . [03] . [03] . [01] . [02] . [04] . [08] . [10]   [20] @ [40] . [80] . [01] . [02] . [04] . [08] . [10]   [20] . [01] . [02] . [04] . [08] . [10]   [20] . [00] . [00] . [00] . [07] . [00] . [02] . [01] . [00] . [00] . [03] . [04] . [06] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [11] $ [24] . [1f] . [be] . [cf] . [ef] . [d8] . [e0] . [de] . [bf] . [cd] . [bf] . [11] . [e0] . [a0] . [e0] . [b1] . [e0] . [ea] . [e3] . [f4] . [e0] . [02] . [c0] . [05] . [90] . [0d] . [92] . [a2] 0 [30] . [b1] . [07] . [d9] . [f7] . [11] . [e0] . [a2] . [e0] . [b1] . [e0] . [01] . [c0] . [1d] . [92] . [ab] 0 [30] . [b1] . [07] . [e1] . [f7] . [0e] . [94] . [0c] . [02] . [0c] . [94] . [1b] . [02] . [0c] . [94] . [00] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [80] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] . [80] . [91] . [00] . [01] a [61] . [e0] . [0e] . [94] . [b8] . [01] h [68] . [ee] s [73] . [e0] . [80] . [e0] . [90] . [e0] . [0e] . [94] . [e5] . [00] . [80] . [91] . [00] . [01] ` [60] . [e0] . [0e] . [94] . [b8] . [01] h [68] . [ee] s [73] . [e0] . [80] . [e0] . [90] . [e0] . [0e] . [94] . [e5] . [00] . [08] . [95] . [80] . [91] . [00] . [01] a [61] . [e0] . [0e] . [94] y [79] . [01] . [08] . [95] . [1f] . [92] . [0f] . [92] . [0f] . [b6] . [0f] . [92] . [11] $ [24] / [2f] . [93] ? [3f] . [93] . [8f] . [93] . [9f] . [93] . [af] . [93] . [bf] . [93] . [80] . [91] . [06] . [01] . [90] . [91] . [07] . [01] . [a0] . [91] . [08] . [01] . [b0] . [91] . [09] . [01] 0 [30] . [91] . [0a] . [01] . [01] . [96] . [a1] . [1d] . [b1] . [1d] # [23] / [2f] - [2d] _ [5f] - [2d] 7 [37]   [20] . [f0] - [2d] W [57] . [01] . [96] . [a1] . [1d] . [b1] . [1d]   [20] . [93] . [0a] . [01] . [80] . [93]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [c0] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] . [06] . [01] . [90] . [93] . [07] . [01] . [a0] . [93] . [08] . [01] . [b0] . [93] . [09] . [01] . [80] . [91] . [02] . [01] . [90] . [91] . [03] . [01] . [a0] . [91] . [04] . [01] . [b0] . [91] . [05] . [01] . [01] . [96] . [a1] . [1d] . [b1] . [1d] . [80] . [93] . [02] . [01] . [90] . [93] . [03] . [01] . [a0] . [93] . [04] . [01] . [b0] . [93] . [05] . [01] . [bf] . [91] . [af] . [91] . [9f] . [91] . [8f] . [91] ? [3f] . [91] / [2f] . [91] . [0f] . [90] . [0f] . [be] . [0f] . [90] . [1f] . [90] . [18] . [95] . [9b] . [01] . [ac] . [01] . [7f] . [b7] . [f8] . [94] . [80] . [91] . [02] . [01] . [90] . [91] . [03] . [01] . [a0] . [91] . [04] . [01] . [b0] . [91] . [05] . [01] f [66] . [b5] . [a8] . [9b] . [05] . [c0] o [6f] ? [3f] . [19] . [f0] . [01] . [96] . [a1] . [1d] . [b1] . [1d] . [7f] . [bf] . [ba] / [2f] . [a9] / [2f] . [98] / [2f] . [88] ' [27] . [86] . [0f] . [91] . [1d]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [00] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] . [a1] . [1d] . [b1] . [1d] b [62] . [e0] . [88] . [0f] . [99] . [1f] . [aa] . [1f] . [bb] . [1f] j [6a] . [95] . [d1] . [f7] . [bc] . [01] - [2d] . [c0] . [ff] . [b7] . [f8] . [94] . [80] . [91] . [02] . [01] . [90] . [91] . [03] . [01] . [a0] . [91] . [04] . [01] . [b0] . [91] . [05] . [01] . [e6] . [b5] . [a8] . [9b] . [05] . [c0] . [ef] ? [3f] . [19] . [f0] . [01] . [96] . [a1] . [1d] . [b1] . [1d] . [ff] . [bf] . [ba] / [2f] . [a9] / [2f] . [98] / [2f] . [88] ' [27] . [8e] . [0f] . [91] . [1d] . [a1] . [1d] . [b1] . [1d] . [e2] . [e0] . [88] . [0f] . [99] . [1f] . [aa] . [1f] . [bb] . [1f] . [ea] . [95] . [d1] . [f7] . [86] . [1b] . [97] . [0b] . [88] ^ [5e] . [93] @ [40] . [c8] . [f2] ! [21] P [50] 0 [30] @ [40] @ [40] @ [40] P [50] @ [40] h [68] Q [51] | [7c] O [4f] ! [21] . [15] 1 [31] . [05] A [41] . [05] Q [51] . [05] q [71] . [f6] . [08] . [95] x [78] . [94] . [84] . [b5]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] @ [40] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] . [82] ` [60] . [84] . [bd] . [84] . [b5] . [81] ` [60] . [84] . [bd] . [85] . [b5] . [82] ` [60] . [85] . [bd] . [85] . [b5] . [81] ` [60] . [85] . [bd] . [ee] . [e6] . [f0] . [e0] . [80] . [81] . [81] ` [60] . [80] . [83] . [e1] . [e8] . [f0] . [e0] . [10] . [82] . [80] . [81] . [82] ` [60] . [80] . [83] . [80] . [81] . [81] ` [60] . [80] . [83] . [e0] . [e8] . [f0] . [e0] . [80] . [81] . [81] ` [60] . [80] . [83] . [e1] . [eb] . [f0] . [e0] . [80] . [81] . [84] ` [60] . [80] . [83] . [e0] . [eb] . [f0] . [e0] . [80] . [81] . [81] ` [60] . [80] . [83] . [ea] . [e7] . [f0] . [e0] . [80] . [81] . [84] ` [60] . [80] . [83] . [80] . [81] . [82] ` [60] . [80] . [83] . [80] . [81] . [81] ` [60] . [80] . [83] . [80] . [81] . [80] h [68] . [80] . [83] . [10] . [92] . [c1] . [00] . [08] . [95] . [cf] . [93] . [df] . [93] H [48] / [2f] P [50] . [e0] . [ca] . [01] . [86] V [56] . [9f] O [4f]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [80] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] . [fc] . [01] 4 [34] . [91] J [4a] W [57] _ [5f] O [4f] . [fa] . [01] . [84] . [91] . [88] # [23] i [69] . [f1] . [90] . [e0] . [88] . [0f] . [99] . [1f] . [fc] . [01] . [e8] Y [59] . [ff] O [4f] . [a5] . [91] . [b4] . [91] . [fc] . [01] . [ee] X [58] . [ff] O [4f] . [c5] . [91] . [d4] . [91] f [66] # [23] Q [51] . [f4] / [2f] . [b7] . [f8] . [94] . [8c] . [91] . [93] / [2f] . [90] . [95] . [89] # [23] . [8c] . [93] . [88] . [81] . [89] # [23] . [0b] . [c0] b [62] 0 [30] a [61] . [f4] / [2f] . [b7] . [f8] . [94] . [8c] . [91] . [93] / [2f] . [90] . [95] . [89] # [23] . [8c] . [93] . [88] . [81] . [83] + [2b] . [88] . [83] / [2f] . [bf] . [06] . [c0] . [9f] . [b7] . [f8] . [94] . [8c] . [91] . [83] + [2b] . [8c] . [93] . [9f] . [bf] . [df] . [91] . [cf] . [91] . [08] . [95] H [48] / [2f] P [50] . [e0] . [ca] . [01] . [82] U [55] . [9f] O [4f] . [fc] . [01] $ [24] . [91] . [ca] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [c0] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] . [80] F [46] . [86] V [56] . [9f] O [4f] . [fc] . [01] . [94] . [91] J [4a] W [57] _ [5f] O [4f] . [fa] . [01] 4 [34] . [91] 3 [33] # [23] . [09] . [f4] @ [40] . [c0] " [22] # [23] Q [51] . [f1] # [23] 0 [30] q [71] . [f0] $ [24] 0 [30] ( [28] . [f4] ! [21] 0 [30] . [a1] . [f0] " [22] 0 [30] . [11] . [f5] . [14] . [c0] & [26] 0 [30] . [b1] . [f0] ' [27] 0 [30] . [c1] . [f0] $ [24] 0 [30] . [d9] . [f4] . [04] . [c0] . [80] . [91] . [80] . [00] . [8f] w [77] . [03] . [c0] . [80] . [91] . [80] . [00] . [8f] } [7d] . [80] . [93] . [80] . [00] . [10] . [c0] . [84] . [b5] . [8f] w [77] . [02] . [c0] . [84] . [b5] . [8f] } [7d] . [84] . [bd] . [09] . [c0] . [80] . [91] . [b0] . [00] . [8f] w [77] . [03] . [c0] . [80] . [91] . [b0] . [00] . [8f] } [7d] . [80] . [93] . [b0] . [00] . [e3] / [2f] . [f0] . [e0] . [ee] . [0f] . [ff] . [1f] . [ee] X [58] . [ff] O [4f] . [a5] . [91] . [b4] . [91] / [2f] . [b7]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [00] . [02]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: d [64] . [00] < [3c] F [46] . [f8] . [94] f [66] # [23] ! [21] . [f4] . [8c] . [91] . [90] . [95] . [89] # [23] . [02] . [c0] . [8c] . [91] . [89] + [2b] . [8c] . [93] / [2f] . [bf] . [08] . [95] . [cf] . [93] . [df] . [93] . [0e] . [94] > [3e] . [01] . [0e] . [94] . [97] . [00] . [c0] . [e0] . [d0] . [e0] . [0e] . [94] . [80] . [00]   [20] . [97] . [e1] . [f3] . [0e] . [94] . [00] . [00] . [f9] . [cf] . [f8] . [94] . [ff] . [cf] . [0d] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    ### | 100% 0.27s

    avrdude: 1084 bytes of flash written
    avrdude: verifying flash memory against G:\Temp\build5658632448223358877.tmp\Blink.cpp.hex:
    avrdude: load data flash data from input file G:\Temp\build5658632448223358877.tmp\Blink.cpp.hex:
    avrdude: input file G:\Temp\build5658632448223358877.tmp\Blink.cpp.hex contains 1084 bytes
    avrdude: reading on-chip flash data:

    Reading | avrdude: Send: U [55] . [00] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [0c] . [94] a [61] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] . [9d] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [00] . [00] . [00] . [00] $ [24] . [00] ' [27] . [00] * [2a] . [00] . [00] . [00] . [00] . [00] % [25] . [00] ( [28] . [00] + [2b] . [00] . [00] . [00] . [00] . [00]
    avrdude: Recv: . [10]
    #####avrdude: Send: U [55] @ [40] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: # [23] . [00] & [26] . [00] ) [29] . [00] . [04] . [04] . [04] . [04] . [04] . [04] . [04] . [04] . [02] . [02] . [02] . [02] . [02] . [02] . [03] . [03] . [03] . [03] . [03] . [03] . [01] . [02] . [04] . [08] . [10]   [20] @ [40] . [80] . [01] . [02] . [04] . [08] . [10]   [20] . [01] . [02] . [04] . [08] . [10]   [20] . [00] . [00] . [00] . [07] . [00] . [02] . [01] . [00] . [00] . [03] . [04] . [06] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [11] $ [24] . [1f] . [be] . [cf] . [ef] . [d8] . [e0] . [de] . [bf] . [cd] . [bf] . [11] . [e0] . [a0] . [e0] . [b1] . [e0] . [ea] . [e3] . [f4] . [e0] . [02] . [c0] . [05] . [90] . [0d] . [92] . [a2] 0 [30] . [b1] . [07] . [d9] . [f7] . [11] . [e0] . [a2] . [e0] . [b1] . [e0] . [01] . [c0] . [1d] . [92] . [ab] 0 [30] . [b1] . [07] . [e1] . [f7] . [0e] . [94] . [0c] . [02] . [0c] . [94] . [1b] . [02] . [0c] . [94] . [00] . [00]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [80] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [80] . [91] . [00] . [01] a [61] . [e0] . [0e] . [94] . [b8] . [01] h [68] . [ee] s [73] . [e0] . [80] . [e0] . [90] . [e0] . [0e] . [94] . [e5] . [00] . [80] . [91] . [00] . [01] ` [60] . [e0] . [0e] . [94] . [b8] . [01] h [68] . [ee] s [73] . [e0] . [80] . [e0] . [90] . [e0] . [0e] . [94] . [e5] . [00] . [08] . [95] . [80] . [91] . [00] . [01] a [61] . [e0] . [0e] . [94] y [79] . [01] . [08] . [95] . [1f] . [92] . [0f] . [92] . [0f] . [b6] . [0f] . [92] . [11] $ [24] / [2f] . [93] ? [3f] . [93] . [8f] . [93] . [9f] . [93] . [af] . [93] . [bf] . [93] . [80] . [91] . [06] . [01] . [90] . [91] . [07] . [01] . [a0] . [91] . [08] . [01] . [b0] . [91] . [09] . [01] 0 [30] . [91] . [0a] . [01] . [01] . [96] . [a1] . [1d] . [b1] . [1d] # [23] / [2f] - [2d] _ [5f] - [2d] 7 [37]   [20] . [f0] - [2d] W [57] . [01] . [96] . [a1] . [1d] . [b1] . [1d]   [20] . [93] . [0a] . [01] . [80] . [93]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [c0] . [00]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [06] . [01] . [90] . [93] . [07] . [01] . [a0] . [93] . [08] . [01] . [b0] . [93] . [09] . [01] . [80] . [91] . [02] . [01] . [90] . [91] . [03] . [01] . [a0] . [91] . [04] . [01] . [b0] . [91] . [05] . [01] . [01] . [96] . [a1] . [1d] . [b1] . [1d] . [80] . [93] . [02] . [01] . [90] . [93] . [03] . [01] . [a0] . [93] . [04] . [01] . [b0] . [93] . [05] . [01] . [bf] . [91] . [af] . [91] . [9f] . [91] . [8f] . [91] ? [3f] . [91] / [2f] . [91] . [0f] . [90] . [0f] . [be] . [0f] . [90] . [1f] . [90] . [18] . [95] . [9b] . [01] . [ac] . [01] . [7f] . [b7] . [f8] . [94] . [80] . [91] . [02] . [01] . [90] . [91] . [03] . [01] . [a0] . [91] . [04] . [01] . [b0] . [91] . [05] . [01] f [66] . [b5] . [a8] . [9b] . [05] . [c0] o [6f] ? [3f] . [19] . [f0] . [01] . [96] . [a1] . [1d] . [b1] . [1d] . [7f] . [bf] . [ba] / [2f] . [a9] / [2f] . [98] / [2f] . [88] ' [27] . [86] . [0f] . [91] . [1d]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [00] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [a1] . [1d] . [b1] . [1d] b [62] . [e0] . [88] . [0f] . [99] . [1f] . [aa] . [1f] . [bb] . [1f] j [6a] . [95] . [d1] . [f7] . [bc] . [01] - [2d] . [c0] . [ff] . [b7] . [f8] . [94] . [80] . [91] . [02] . [01] . [90] . [91] . [03] . [01] . [a0] . [91] . [04] . [01] . [b0] . [91] . [05] . [01] . [e6] . [b5] . [a8] . [9b] . [05] . [c0] . [ef] ? [3f] . [19] . [f0] . [01] . [96] . [a1] . [1d] . [b1] . [1d] . [ff] . [bf] . [ba] / [2f] . [a9] / [2f] . [98] / [2f] . [88] ' [27] . [8e] . [0f] . [91] . [1d] . [a1] . [1d] . [b1] . [1d] . [e2] . [e0] . [88] . [0f] . [99] . [1f] . [aa] . [1f] . [bb] . [1f] . [ea] . [95] . [d1] . [f7] . [86] . [1b] . [97] . [0b] . [88] ^ [5e] . [93] @ [40] . [c8] . [f2] ! [21] P [50] 0 [30] @ [40] @ [40] @ [40] P [50] @ [40] h [68] Q [51] | [7c] O [4f] ! [21] . [15] 1 [31] . [05] A [41] . [05] Q [51] . [05] q [71] . [f6] . [08] . [95] x [78] . [94] . [84] . [b5]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] @ [40] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [82] ` [60] . [84] . [bd] . [84] . [b5] . [81] ` [60] . [84] . [bd] . [85] . [b5] . [82] ` [60] . [85] . [bd] . [85] . [b5] . [81] ` [60] . [85] . [bd] . [ee] . [e6] . [f0] . [e0] . [80] . [81] . [81] ` [60] . [80] . [83] . [e1] . [e8] . [f0] . [e0] . [10] . [82] . [80] . [81] . [82] ` [60] . [80] . [83] . [80] . [81] . [81] ` [60] . [80] . [83] . [e0] . [e8] . [f0] . [e0] . [80] . [81] . [81] ` [60] . [80] . [83] . [e1] . [eb] . [f0] . [e0] . [80] . [81] . [84] ` [60] . [80] . [83] . [e0] . [eb] . [f0] . [e0] . [80] . [81] . [81] ` [60] . [80] . [83] . [ea] . [e7] . [f0] . [e0] . [80] . [81] . [84] ` [60] . [80] . [83] . [80] . [81] . [82] ` [60] . [80] . [83] . [80] . [81] . [81] ` [60] . [80] . [83] . [80] . [81] . [80] h [68] . [80] . [83] . [10] . [92] . [c1] . [00] . [08] . [95] . [cf] . [93] . [df] . [93] H [48] / [2f] P [50] . [e0] . [ca] . [01] . [86] V [56] . [9f] O [4f]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [80] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [fc] . [01] 4 [34] . [91] J [4a] W [57] _ [5f] O [4f] . [fa] . [01] . [84] . [91] . [88] # [23] i [69] . [f1] . [90] . [e0] . [88] . [0f] . [99] . [1f] . [fc] . [01] . [e8] Y [59] . [ff] O [4f] . [a5] . [91] . [b4] . [91] . [fc] . [01] . [ee] X [58] . [ff] O [4f] . [c5] . [91] . [d4] . [91] f [66] # [23] Q [51] . [f4] / [2f] . [b7] . [f8] . [94] . [8c] . [91] . [93] / [2f] . [90] . [95] . [89] # [23] . [8c] . [93] . [88] . [81] . [89] # [23] . [0b] . [c0] b [62] 0 [30] a [61] . [f4] / [2f] . [b7] . [f8] . [94] . [8c] . [91] . [93] / [2f] . [90] . [95] . [89] # [23] . [8c] . [93] . [88] . [81] . [83] + [2b] . [88] . [83] / [2f] . [bf] . [06] . [c0] . [9f] . [b7] . [f8] . [94] . [8c] . [91] . [83] + [2b] . [8c] . [93] . [9f] . [bf] . [df] . [91] . [cf] . [91] . [08] . [95] H [48] / [2f] P [50] . [e0] . [ca] . [01] . [82] U [55] . [9f] O [4f] . [fc] . [01] $ [24] . [91] . [ca] . [01]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [c0] . [01]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] . [80] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [86] V [56] . [9f] O [4f] . [fc] . [01] . [94] . [91] J [4a] W [57] _ [5f] O [4f] . [fa] . [01] 4 [34] . [91] 3 [33] # [23] . [09] . [f4] @ [40] . [c0] " [22] # [23] Q [51] . [f1] # [23] 0 [30] q [71] . [f0] $ [24] 0 [30] ( [28] . [f4] ! [21] 0 [30] . [a1] . [f0] " [22] 0 [30] . [11] . [f5] . [14] . [c0] & [26] 0 [30] . [b1] . [f0] ' [27] 0 [30] . [c1] . [f0] $ [24] 0 [30] . [d9] . [f4] . [04] . [c0] . [80] . [91] . [80] . [00] . [8f] w [77] . [03] . [c0] . [80] . [91] . [80] . [00] . [8f] } [7d] . [80] . [93] . [80] . [00] . [10] . [c0] . [84] . [b5] . [8f] w [77] . [02] . [c0] . [84] . [b5] . [8f] } [7d] . [84] . [bd] . [09] . [c0] . [80] . [91] . [b0] . [00] . [8f] w [77] . [03] . [c0] . [80] . [91] . [b0] . [00] . [8f] } [7d] . [80] . [93] . [b0] . [00] . [e3] / [2f] . [f0] . [e0] . [ee] . [0f] . [ff] . [1f] . [ee] X [58] . [ff] O [4f] . [a5] . [91] . [b4] . [91] / [2f] . [b7]
    avrdude: Recv: . [10]
    ######avrdude: Send: U [55] . [00] . [02]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]
    avrdude: Send: t [74] . [00] < [3c] F [46]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [f8] . [94] f [66] # [23] ! [21] . [f4] . [8c] . [91] . [90] . [95] . [89] # [23] . [02] . [c0] . [8c] . [91] . [89] + [2b] . [8c] . [93] / [2f] . [bf] . [08] . [95] . [cf] . [93] . [df] . [93] . [0e] . [94] > [3e] . [01] . [0e] . [94] . [97] . [00] . [c0] . [e0] . [d0] . [e0] . [0e] . [94] . [80] . [00]   [20] . [97] . [e1] . [f3] . [0e] . [94] . [00] . [00] . [f9] . [cf] . [f8] . [94] . [ff] . [cf] . [0d] . [00]
    avrdude: Recv: . [10]
    ### | 100% 0.20s

    avrdude: verifying ...
    avrdude: 1084 bytes of flash verified
    avrdude: Send: Q [51]   [20]
    avrdude: Recv: . [14]
    avrdude: Recv: . [10]

    avrdude done.  Thank you.

body:
This is not an error. AVRDude is running with the Verbose flag on. Verbose in English means:

> using or expressed in more words than are needed.

In the Arduino IDE:

![Running with the Verbose flag.][1]

  [1]: https://i.stack.imgur.com/7ZYID.png


message:
Turn Arduino on only by double tapping switch?

I don't have much experience with electronics. I was wondering if it is possible to create a push button switch, which will turn on the device only if it is tapped twice in quick succession?

If it is tapped only once, then the device should behave as if nothing happened (i.e. tapping the switch again after a specified duration should have no effect).

body:
You can use something like the ATtiny25/45/85 then have a button cell battery to power it, make it a sleeper that listens to the button, and when clicked it activates the Arduino.

The Arduino is then turned on keeping a capacitor alive holding a transistor active, then add another button that drains the capacitor, thus closing the transistor and turning the Arduino off. Or you can program the ATtiny to drain the capacitor if the button is held down.

A button cell on an ATtiny in sleepmode should last around a year or so.

Just some information to get you going further:

http://playground.arduino.cc/Learning/arduinoSleepCode : The sleeper code, it is power saving using interrupts.

http://www.instructables.com/id/Program-an-ATtiny-with-Arduino/ : How to burn an ATtiny using Arduino. Fairly simple, did it myself a few times.


message:
How can I program an arduino in pure C/C++?

I am a beginner and I want to learn AVR C/C++. Can I do this using an Arduino?  (I'm asking this because I already have one).

If so, could someone tell me using which IDE can I write code in pure C/C++ and then flash it to the Atmega328P on the Arduino?  Or, should I get an AVR and a programmer instead?

I've searched all over the internet and I'm really confused by all the terminology. Could someone explain it to me?

body:
Yes, get an AVR programmer instead.

1) You can flash your arduino board with **avrdude/avr-gcc**. Install these tools, find the datasheet of atmega328 (google it), use the board pinouts to connect to your programmer (stk500v2/ISP) and voila!

2) Keep in mind that by "manually" flashing your atmaga on arduino board you're removing bootloader that is needed to load your sketches from ARDUINO IDE.

3) Use your favourite C/C++ IDE


body:
If you're a beginner, I suggest you write C in the Arduino IDE. The libraries are very useful and I think the Arduino/Wiring/Processing environment will cover all your needs.

Check out the Lightblue Bean (http://punchthrough.com/bean/) it is a good example of the power of that platform. Even experienced embedded programmers can use it, since the underlying register are still accessible.

I am now programming on the Ti MSP430, and while I can appreciate the possibilities, I miss the simplicity of Arduino; much easier to get started with Arduino.

Go to http://arduino.cc/en/main/software to download the 1.0.6. IDE software, plug your Arduino, go to Tools->Board to select your Arduino, select the appropriate "tty" port in the Tools->Serial_Port.
Then write in pure C and download. There are tons of examples included with the IDE.


body:
An Arduino is programmed in C/C++. There is a common misconception that Arduino has its own language. See this link [C++ vs. The Arduino Language?][1] for a full discussion on Arduino being C/C++ and the simplifications Arduino offers. Further more, you can see the [Arduino core code here][2].

### From the Arduino website:
> [Can I program the Arduino board in C?][3]
In fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs [supported by avr-g++][4] should work in Arduino. For more details, see the page on the [Arduino build process][5].

Arduino offers an easy learning curve for beginners through to experts. So simply [download the latest Arduino IDE][6], install it and enjoy.

  [1]: https://arduino.stackexchange.com/q/816/19409
  [2]: https://github.com/arduino/ArduinoCore-avr/tree/master/cores/arduino
  [3]: https://www.arduino.cc/en/Main/FAQ#toc13
  [4]: https://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_cplusplus
  [5]: https://arduino.github.io/arduino-cli/sketch-build-process/
  [6]: https://www.arduino.cc/en/Main/Software


message:
How do I connect this display to an Arduino Uno

I am completely new to this, and a novice when it comes to electronics but I want to learn.
Can someone pls tell me how I would connect the display in the photo here with an Arduino Uno (which I have ordered).  The plan is to interface my car with this transparent display to produce a form of HUD.
I have done some searching but to no avail so far, would appreciate being pointed in the right direction.
many thanks![transparent LCD clock][1]

  [1]: https://i.stack.imgur.com/5KfTx.jpg

body:
You're in for a *lot* of work. Everything on the PCB is useless to you, so you'd have to interface the raw panel to the Arduino.

The first matter is to remove the panel from the board. You will need to desolder all of the connections, and then solder either some sort of rigid connector or individual wires to the large ribbon connector. The only advice I can give you is "be prepared to fail".

Once you've done that, you will need to read AVR340 in order to learn how to drive the panel. Note that the Uno itself does not have enough pins to drive the panel directly, so you will need to get an I/O expander or two for this.

Did I mention that you're in for a lot of work? Well, I'm mentioning it again. Good luck though.


message:
Advisability of Using Bit Fields in Structs

I have to track a large amount of data (for an Arduino) in a program while taking care of a fair amount of other business.

I started with a struct like this:

    struct MyStruct
    {
       // note: these names might as well be foo bar baz
       uint8_t color;
       boolean state;
       uint8_t area;
       uint8_t number;
       uint8_t len;
    };

I have an array of 800 of these. At 5 bytes each, that's 4Kb, or half the ram on the Arduino Mega.

I changed to a struct like this:

    struct MyStruct
    {
       uint8_t color : 3; // max value 7
       // uint8_t state : 1; *** moved, thanks Ignacio ***
       uint8_t area : 5; // m.v. 31
       uint8_t number;
       uint8_t len : 5; // m.v. 31
       uint8_t state : 1; // m.v. 1
    };

I understand this reduces the size of each instance to 3 bytes, for a total of 2.4Kb in my array.

I have read that in some implementations / chipsets using bit fields in structs can lead to less efficient execution. Obviously this is a more efficient use of memory, but my question is:

How does the Arduino handle bit fields? Will it be better, worse, or negligibly different in terms or speed when iterating through an array of bit field structs? Is there a good way to test this?

body:
What you are facing is the classic time-memory tradeoff.  The bit fields will be smaller in memory,  but will take more time to operate on.  You can count that no matter what processor, the bit fields will be slower.

You use the word *efficient*, but that word has no certain meaning without a metric for what is good or bad.  When you only have 8 k of RAM, using memory is bad, time may be cheap.  If you have real time constraints, then using time is bad and memory may be cheap.  In general, you can only buy your way out of this tradeoff.  In other words, when you find both time and memory bad, spend cash and use a bigger chip.  There is no single answer for what is good or bad.  This is part of why there are so many choices for microcontrollers, people fit the chip to the application and application to the chip.

Populating the bits of a bit field will be slower than filling of complete bytes.  Take for example

    x = 5;
    ...
    asimplestruct.len = x;
    // vs
    abitfield.len = x;

The first simple case will just:

  - load value of x to a register
  - store it to the byte for len

The second does something like:

  - loads the current value of abitfield
  - loads a mask
  - clears the bits for len
  - loads current value of x
  - loads a mask
  - clears off unused bits of x
  - shifts the bits of x
  - or's x with the abitfield
  - stores the current value back to memory

If all your operations are packing data into the bit field, or unpacking out of the bitfield, you should expect slower execution.  Bit fields are a type of compression - they cost ticks.

But moving around bit fields will be faster because there are less bytes to load and store.  If you where sorting this array, the smaller byte count could be an advantage.  If you where transferring them over a serial port, the compressed size of the bitfield might be a winner.

So with respect to your question:

> Is there a good way to test this?

The only good way to test this is to write test cases for both approaches using a pattern that closely matches your application.  It really matters what mix of operations you perform to decide whether the difference is negligible or significant.

When doing this sort of optimization experiment, definitely use source control on your project.  You can create a local GIT or Mercurial repository with just a few clicks.  Keeping a chain of checkpoints allows you to tear up your code exploring the effects of different implementations.  If you take a wrong turn, the repository allows you to simply go back to the last good point and try another path.

 (Side note:  This time memory tradeoff exists in the opposite direction also.  If you look through the compiler options for desktop class processors, you will find something called *structure packing*.  This option allow you to add blank bytes between single byte fields such that they stay aligned at word or double word boundaries.  This may seem crazy to throw away RAM on purpose, but on processors with 16 or 32 bit wide registers and buses, so called word or dword aligned memory operations can be faster than byte wise operations.)


body:
A little tip - I see that the struct is not a 1B aligned for 8bit CPU. At the end of your struct you can add *padding* 2bit length or rethink increase of the size of **state**.

    struct MyStruct
    {
       uint8_t color : 3; // max value 7
       // uint8_t state : 1; *** moved, thanks Ignacio ***
       uint8_t area : 5; // m.v. 31
       uint8_t number;
       uint8_t len : 5; // m.v. 31
       uint8_t state : 1; // m.v. 1
       uint8_t padding : 2;
    };


body:
A discussion of bit-fields wouldn't be complete without mentioning that:

> Structures with bit-fields may be used as a portable way of attempting to reduce the storage required for a structure (with the probable cost of increasing the instruction space, and time, needed to access the fields), or as a non-portable way to describe a storage layout known at the bit level.

[Kernighan & Ritchie, *The C Programming Language, Second Edition*, Appendix A-8.3]

Other posters, including yourself, have addressed the space/time tradeoff. But what is sometimes missed (possibly not relevant to your application - ?) is the complete *implementation-dependence of the storage layout*. This matters when applications share this data with another process: Reading or writing hardware, whose register bit-assignments are necessarily fixed; communicating the data to another system (via network or storage device doesn't matter); or to another application on the same system, that may have been compiled with a different compiler or version of the compiler.


message:
Controlling Dynamixel MX24T, MX64T servo wirelessly using Arduino Mega?

I am planning to control multiple Dynamixel servos (MX28T or MX-64T) wirelessly using an Arduino Mega. Since this servo uses serial communication, I need an additional serial port to interface with XBee module. Although it seems to be very common application controlling these servos wirelessly based on Arduino, I could't find any of them in web. I found the two very well constructed libraries.

1. https://code.google.com/p/slide-33/downloads/list. This library is for MX28T servo, which is the same servo I am trying to use, but it uses UNO;therefore, I cannot interface with XBee.

2. [The Arduino/Dynamixel Resource Page...][1] This library uses UART1 (serial1) to interface with servo (AX-12) motors. Therefore, I can connect XBee module to UART0. But, the problem is that this library is outdated and not compatible with MX64-T servo anymore.

So my questions are:

1. Is there any one who has experience in controlling Dynamixel MX24T, MX64T servo series using XBee module simultaneously? If you have experience, please share with me.

2. Is it possible for Arduino Mega can interface with Xbee module using Serial1 (i.e., RX18 TX19)? If it can, I might be able to use the library1 without any modification.

  [1]: http://www.pablogindel.com/informacion/the-arduinodynamixel-resource-page/

body:
I know, Although it is not ZigBee, ROBOTIS Arduino Shield(https://emanual.robotis.com/docs/en/parts/interface/dynamixel_shield/) can use BLE module (BT-410). My recommendation is Arduino compatible OpenCM 9.04(https://emanual.robotis.com/docs/en/parts/controller/opencm904/).

Arobotix-M(https://www.trossenrobotics.com/p/arbotix-robot-controller.aspx), you can use ZigBee.


message:
Why can't I read anything but Pin 0 of PORTC?

So I am working on this lab for my Embedded Systems class, but I can't seem to read anything but the first bit of PORTC.  What's even weirder is that if any of the pins go low the first bit will go to 0, while all the others stay at 0 no matter what.

Here is my code:

     /*
     * Lab_4A.c
     *
     * Reads the value of one distance sensor
     * and reports if light/dark to the LCD.
     *
     *  Created on: Sep 24, 2014
     *  Author: Austin R. Bartz
     *
     * LCD Connections:
     * E - PB4 (Digital 12)
     * RS - PB5 (Digital 13)
     * R/W - GND
     * Data 4,5,6,7 - PD4,5,6,7 (Digital 4,5,6,7)
     *
     * Sensor Connections:
     * Sensor 8 - PC0 (Analog A0)
     * Sensor 7 - PC1 (Analog A1)
     * Sensor 6 - PC2 (Analog A2)
     * Sensor 5 - PC3 (Analog A3)
     */

    #include <avr/io.h>
    #include <inttypes.h>
    #include <MSOE/delay.c>
    #include <MSOE/bit.c>
    #include <MSOE/lcd.c>
    #include <user/initPorts.c>
    #include <user/readPorts.c>
    #include <user/writePorts.c>

    void printBinaryLCD(uint8_t);
    uint8_t readSensors();

    int main(void)
    {
     lcd_init();
     lcd_clear();
     while(1)
     {
      uint8_t val = readSensors();
      printBinaryLCD(val);
     }
    }

    void printBinaryLCD(uint8_t val)
    {
     lcd_home();
     uint8_t A = ((PINC & (1<<3)) == (1<<3));
     lcd_print_uint8(A);
     lcd_goto_xy(1,0);
     uint8_t B = ((PINC & (1<<2)) == (1<<2));
     lcd_print_uint8(B);
     lcd_goto_xy(2,0);
     uint8_t C = ((PINC & (1<<1)) == (1<<1));
     lcd_print_uint8(C);
     lcd_goto_xy(3,0);
     uint8_t D = ((PINC & (1<<0)) == (1<<0));
     lcd_print_uint8(D);
    }

    uint8_t readSensors()
    {
     DDRC = 1;
     PORTC = 1;
     delay_us(10);
     DDRC = 0;
     PORTC = 0;
     delay_ms(1);
     return PINC;
    }

Any help would be much appreciated!

body:
i can't be certain, but i reckon it has something to do with

    DDRC = 1;

this equates to b000001, meaning only pinC0 is an output. i think


body:
`DDRx` is the Data-Direction-Register-x so this can be `DDRC` or `DDRD` or anything. One register has 8 bits, 1 bit for every pin.
Making a bit 1 will result in the pin being an output. Making it 0 will result in the pin being an input.

Let's say we want to make pin 4 and 5 of port C an output.
We simply do this in the setup:

           //76543210  Pin numbers.
           //IIOOIIII  Input/Output indicator
    DDRC = 0b00110000;//Code that actually does it.

So this way we can read pin 4 & 5.
But if we want to read the complete port, I suggest setting every pin of the port to input. `DDRC = 0b00000000;`

Then we can read the port as simply as `uint8_t portValueC = PORTC;`

portValueC will now have a value that represents the port's values.
It'll be binary, but you read it as decimal.
So it'll be:

    0 for no inputs.
    1 for only pin 0
    2 for pin 1
    3 for pin 0 & 1
    4 for pin 2
    5 for pin 2 & 0
    6 for pin 2 & 1

Well. it's binary.

Let's say (pin 7,5,3,1 high)(pin 6,4,2,0 low).

This will result into the decimal value of 170.

The binary value, however, will be easier to read `0b10101010`

        //76543210
      //0b10101010 (Could be the value) (pin 7,5,3,1 high)(pin 6,4,2,0 low)
    //^ is decimal: 170

You should add these macros to your project to make it easier to get single bits from this value:

    #define bit_get(p,m) ((p) & (m))
    #define bit_set(p,m) ((p) |= (m))
    #define bit_clear(p,m) ((p) &= ~(m))
    #define bit_flip(p,m) ((p) ^= (m))
    #define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))
    #define BIT(x) (0x01 << (x))

This way, now you can do:

    if(bit_get(PINC, BIT(3)))
    {
     //Do only this if PORTC pin 3 is high
    }

Read this first:

[Info on the registers][1]

[Info on bit fiddling][2]

  [1]: http://www.elecrom.com/2008/02/12/avr-tutorial-2-avr-input-output/
  [2]: http://www.avrfreaks.net/forum/tut-c-bit-manipulation-aka-programming-101?name=PNphpBB2&file=viewtopic&t=37871


body:
Judging from your `readSensors()` function, these seem to be capacitive
sensors:

* you charge them to Vcc (`DDRC = 1; PORTC = 1;`)
* you wait until they are fully charged (`delay_us(10);`)
* you tri-state the pin (`DDRC = 0; PORTC = 0`)
* you wait for them to partially self-discharge (`delay_ms(1);`)
* you read the pin (`return PINC;`)

If my assumption is correct, and if _all_ of those sensors are similar,
then here is your first bug: you are only charging the sensor on PC0. If
you want to charge the four sensors, you need to set bits 0 to 3 of the
port to active high. Thus, the first two statements in `readSensors()`
should be:

<!--language-all: lang-c -->

    DDRC = 0x0f;   // bits 0 to 3...
    PORTC = 0x0f;  // ...set to active high

Your second bug is in `printBinaryLCD()`. The function name, and the way
you call it, implies it is meant to print on the LCD the value passed as
a parameter. Instead, it is completely ignoring its parameter, and
reading `PORTC` itself. This is bad because the reading of the
capacitive sensors is time sensitive, so you should let `readSensors()`
do the work. You should then change `printBinaryLCD()` so that it
examines `val` instead of `PORTC`:

    void printBinaryLCD(uint8_t val)
    {
        lcd_home();
        uint8_t A = (val & (1<<3)) != 0;
        ...etc...


message:
SD card fails to write every 5 or 6 minutes

My SD card initializes fine in the beginning. It finds the right file and opens it. However, after 5 or 6 minutes of data logging, the error "file not found" appears on my LCD. Why would this be the case? I need this to work consistently for at least an hour, this 5 to 6 minutes will not do.

Also, in my code the "sv" and "cpm" data is not yet initialized, due to another problem incorporating a sensor. I left these in there, and the data is just logged as 0 for those variables.

    #include <SPI.h>
    #include <MPL115A1Lib.h>  // Pressure Sensor MPL115A1
    #include <DHT.h>  // Temperature and Humidity Sensor RTH03
    #include <U8glib.h>  // LCD Display 128x64
    #include <floatToString.h>  // Converts floats to strings
    #include <GPS610F.h>  // GPS-610F Module
    #include <RFZuluArduino.h>  // Zulu 2km RF Module
    #include <SD.h> //SD data logger

    //----- Defining Modules and Variables ------//
    // Pressure Sensor
    MPL115A1Lib PressSens;  // Defines Pressure Sensor for library
    #define FT_TO_M(x) ((long)((x)*(0.3048)))
    #define KPA_TO_INHG(x) ((x)*(0.295333727))
    #define KPA_TO_MMHG(x) ((x)*(7.50061683))
    #define KPA_TO_PSIA(x) ((x)*(0.145037738))
    #define KPA_TO_KGCM2(x) ((x)*(0.0102))
    #define INHG_TO_PSIA(x) ((x)*(0.49109778))
    #define DEGC_TO_DEGF(x) ((x)*(9.0/5.0)+32.0)

    float press_pKa = 0;
    float temp_c = 0;
    long alt_ft = 0;
    char charPress[7];  // Stores pressure
    char charTemp[6];  // Stores temperature in C
    char charAlt[5];  // Stores altitude
    // Temperature & Humidity Sensor
    #define DHTPIN 48     // Defines signal pin connection
    #define DHTTYPE DHT22   // Defines Sensor model # DHT22 (RTH03)
    DHT dht(DHTPIN, DHTTYPE);  // Defines the Temp/Humd Sensor
    float t = 0;  // temp
    float h = 0;  // rel. humd.
    float f = 0;  // temp in f
    float hi = 0;  // heat index
    char rh[6];  // Stores Relative Humidity
    char tempC[6];  // Stores Temperature in °C
    char tempF[7];  // Stores Temp in F
    char heatIndex[7];  // Stores heat index
    char degree[3] = {176, 67};  // Stores °C symbol
    char degreeF[3] = {176, 70};  // Stores °F symbol
    // LCD Display
    U8GLIB_ST7920_128X64_4X u8g(41, 42, 43);  // Defines LCD pins (SPI: EN = 41, RW = 42, RS = 43)
    // GPS Module
    GPS610F gps(17, 16, 28, 26, 44, 27, 9600);  // Defines GPS pins (SDI, SDO1, SDO2, PIO, PPS, RST, baudRate)
    String gpsData;
    char charGPS[82] = "";
    String strnmeaProto;
    String strutcTime;
    String strgpsStatus;
    String strlatitude;
    String strnsIndicator;
    String strlongitude;
    String strewIndicator;
    String strspeedOverGnd;
    String strcourseOverGnd;
    String strutcDate;
    String strmagVarDegrees;
    String strmagVarDirection;
    String strmodeIndicator;
    String strcheckSum;
    char nmeaProto[6] = "";
    char utcTime[11] = "";
    char gpsStatus[2] = "";
    char latitude[11] = "";
    char nsIndicator[2] = "";
    char longitude[11] = "";
    char ewIndicator[2] = "";
    char speedOverGnd[6] = "";
    char courseOverGnd[6] = "";
    char utcDate[7] = "";
    char magVarDegrees[6] = "";
    char magVarDirection[2] = "";
    char modeIndicator[2] = "";
    char checkSum[3] = "";
    char tempTime[9] = "";
    char tempDate[9] = "";
    char tempLat[12] = "";
    char tempLong[13] = "";
    // RF Module
    RFZuluArduino rf(15, 14, 2, 3, 4, 5, 4800);  // Defines the RF module's pins (rx1, tx1, RTS, CTS, RST, PD, baudRate)
    //Data Logger
    const int chipsSelect = 10;
    File Data;
    String Header = "DATE(utc)  TIME(utc)  STATUS  MODE  LATITUDE(deg)  LONGITUDE(deg)  SPEED(km)  COURSE(deg)  Temperature(C)  Temperature(F)  Humidity(%RH)  Heat Index(F)  Pressure(kPA)  Altitude(m"; //CPM  uSV/hr";
    int dcounter = 0;
    //Geiger Counter
    unsigned int gcount = 0;
    unsigned int countStartTime = 0;
    int countsPerMinute;
    float coefficientOfConversion = 140.0 / 60000.0;
    float sV = 0;
    String str;  // temporary string
    int draw_state = 0;
    int tracker = 0;

    void setup() {
      pinMode(53, OUTPUT);
      dht.begin();
      if (!SD.begin(10, 11, 12, 13)) {
        // see if the card is present and can be initialized:
        u8g.firstPage();
        do {
          drawCardError();
        }
        while (u8g.nextPage());
        while (1);  // don't do anything more:
      }
      Serial1.begin(9600);
      // start serial port for geiger counter
    }

    void loop() {
      delay(1000);
      //----- Get Sensor Data -----//
      // Temp/Humid
      h = dht.readHumidity();
      t = dht.readTemperature();
      f = dht.readTemperature(true);
      /*if (isnan(h) || isnan(t) || isnan(f)) {  // check for failed reading from sensor
        return;
        }*/
      hi = dht.computeHeatIndex(f, h);
      // Pressure Sensor
      press_pKa = PressSens.calculatePressurekPa();
      alt_ft = PressSens.calculateAltitudeFt(press_pKa);
      // GPS
      gpsData = gps.getData();
      strnmeaProto = gps.dataFields(0);
      strutcTime = gps.dataFields(1);
      strgpsStatus = gps.dataFields(2);
      strlatitude = gps.dataFields(3);
      strnsIndicator = gps.dataFields(4);
      strlongitude = gps.dataFields(5);
      strewIndicator = gps.dataFields(6);
      strspeedOverGnd = gps.dataFields(7);
      strcourseOverGnd = gps.dataFields(8);
      strutcDate = gps.dataFields(9);
      strmagVarDegrees = gps.dataFields(10);
      strmagVarDirection = gps.dataFields(11);
      strmodeIndicator = gps.dataFields(12);
      strcheckSum = gps.dataFields(13);

      //----- Convert to Transmit -----//
      // Temp/Humid
      floatToString(rh, h, 1);  // relative humidity
      floatToString(tempC, t, 1);  // temperature in C
      floatToString(tempF, f, 1);  // temp in F
      floatToString(heatIndex, hi, 1);  // heat index
      // Pressure Sensor
      str = String(FT_TO_M(alt_ft));  // convert altitude in ft to m
      str.toCharArray(charAlt, 5);  // covert string to char array
      floatToString(charPress, press_pKa, 2);
      // GPS Module
      gpsData.toCharArray(charGPS, 80);  // convert string to char array
      strnmeaProto.toCharArray(nmeaProto, 6);
      // time
      strutcTime.toCharArray(utcTime, 11);
      tempTime[0] = utcTime[0];
      tempTime[1] = utcTime[1];
      tempTime[2] = ':';
      tempTime[3] = utcTime[2];
      tempTime[4] = utcTime[3];
      tempTime[5] = ':';
      tempTime[6] = utcTime[4];
      tempTime[7] = utcTime[5];
      strgpsStatus.toCharArray(gpsStatus, 2);
      // latitude
      strlatitude.toCharArray(latitude, 11);
      strnsIndicator.toCharArray(nsIndicator, 2);
      tempLat[0] = latitude[0];
      tempLat[1] = latitude[1];
      tempLat[2] = 176;   // °
      tempLat[3] = latitude[2];
      tempLat[4] = latitude[3];
      tempLat[5] = latitude[4];
      tempLat[6] = latitude[5];
      tempLat[7] = latitude[6];
      tempLat[8] = 39;  // '
      tempLat[9] = ' ';
      tempLat[10] = nsIndicator[0];
      // longitude
      strlongitude.toCharArray(longitude, 11);
      strewIndicator.toCharArray(ewIndicator, 2);
      tempLong[0] = longitude[0];
      tempLong[1] = longitude[1];
      tempLong[2] = longitude[2];
      tempLong[3] = 176;   // °
      tempLong[4] = longitude[3];
      tempLong[5] = longitude[4];
      tempLong[6] = longitude[5];
      tempLong[7] = longitude[6];
      tempLong[8] = longitude[7];
      tempLong[9] = 39;  // '
      tempLong[10] = ' ';
      tempLong[11] = ewIndicator[0];
      strspeedOverGnd.toCharArray(speedOverGnd, 6);
      strcourseOverGnd.toCharArray(courseOverGnd, 6);
      // date
      strutcDate.toCharArray(utcDate, 7);
      tempDate[0] = utcDate[0];
      tempDate[1] = utcDate[1];
      tempDate[2] = '/';
      tempDate[3] = utcDate[2];
      tempDate[4] = utcDate[3];
      tempDate[5] = '/';
      tempDate[6] = utcDate[4];
      tempDate[7] = utcDate[5];
      strmagVarDegrees.toCharArray(magVarDegrees, 6);
      strmagVarDirection.toCharArray(magVarDirection, 2);
      strmodeIndicator.toCharArray(modeIndicator, 2);
      strcheckSum.toCharArray(checkSum, 3);
      // transmit the data
      rf.transmit(gpsData, tempC, rh, charPress);
      //-----Writes Data to SD Card-----//
      Data = SD.open("DATA", FILE_WRITE);
      if (!Data) {
        u8g.firstPage();
        do {
          drawFileError();
        }
        while (u8g.nextPage());
        while (1);  // don't do anything more:
      }
      dcounter++;
      if (dcounter == 1) {
        Data.println(Header);
      }
      Data.print(strutcDate + "     " + strutcTime + "   " + strgpsStatus + "      " + strmodeIndicator + "     " + strlatitude + "     " + strlongitude + "     " + strspeedOverGnd + "        " + strcourseOverGnd + "          ");
      Data.print(t);
      Data.print("          ");
      Data.print(f);
      Data.print("            ");
      Data.print(h);
      Data.print("         ");
      Data.print(hi);
      Data.print("            ");
      Data.print(press_pKa);
      Data.print("         " + str + "  ");
      Data.flush();
      Data.print(countsPerMinute);
      Data.print("  ");
      Data.println(sV, 5);
      Data.flush();
      //----- Output to LCD Display -----//
      u8g.firstPage();
      do {
        draw();
      }
      while (u8g.nextPage());
      tracker++;
      if (tracker <= 2) {
        draw_state = 0;
      } else if (tracker <= 5) {
        draw_state = 1;
      } else if (tracker <= 8) {
        draw_state = 2;
      } else {
        tracker = 3;
      }
    }

    //----- LCD Display Drawings -----//
    void drawCardError() {
      u8g.setColorIndex(1);
      u8g.setFont(u8g_font_baby);
      u8g.drawStr(12, 32, "Card Failed, or not present");
    }

    void drawFileError() {
      u8g.setColorIndex(1);
      u8g.setFont(u8g_font_baby);
      u8g.drawStr(5, 32, "Error opening DATA");
    }

    void draw(void) {
      LCDprepare();
      switch (draw_state) {
        case 0:
          AECLlogo();
          break;
        case 1:
          SensorInfo();
          break;
        case 2:
          GpsInfo();
          break;
      }
    }

body:
Answered by OP in the comments

"fixed, I have remvoed some of the ending code thought. They were just functions for the lcd"


body:
Are you sure there are no rollovers / overflows? Keep in mind the limitations of FAT16, max volume size is 2GB, and only with the max sector size of 512B.

At minimum `dcounter` will overflow in 9 hours if you log every second.


body:
Might be a flaky SD card, you get that sometimes. Try changing to another card and see if it helps.

SD card formatter tool might also be useful: https://www.sdcard.org/downloads/formatter_4/


body:
OK, it looks like this question is going to be floating with not accepted answer for all of eternity since the poster clearly isn't responding to comments.

But if it works for a few minutes and then dies it's probably something silly like opening the same file every second and never closing that's the cause of the issues rather than a bad SD card or a counter that will overflow after 9 hours.


message:
Stepper motor clock

I am currently using an Adafruit motor shield on my arduino uno for the first time.
The idea is turning the stepper motor with basicly 1RPM. But i just cant do it.

This is the first time working with this setup, and i dont know what to do.
Can you people help me?

i'm using the Arduino Uno with ADAFRUIT motorshield. The steppermotor is 48steps / rev
[DATASHEET][1]

The code i have at the moment:

    #include <AFMotor.h>

    AF_Stepper motor(48, 1);

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

      motor.setSpeed(1);

      motor.step(48, FORWARD, DOUBLE);
      motor.release();
      delay(10);
    }

    void loop () {
      motor.step(48, FORWARD, DOUBLE);
    }

Greetings from Holland.

  [1]: http://robocraft.ru/files/datasheet/28BYJ-48.pdf

body:
If the stepper gives you 48 steps and an hour has 60, you need to provide 1,25 rounds in one hour given you only move the minute hand. Then with some gearing you should be able to move the hour hand every round there.

So the best way to do this is to is either to move the hand once and then delay 1 minute, 1 minute = 60 seconds **x** 1000 milliseconds.

You then need to figure out what it requires of the stepper motor to make 1 step, with some stepper motors you need to move forward 1 cycle and then back a half. to make a step. You should find all this in the documentation.

Please provide feedback in the comments below so we can improve the answer.


body:
Unsure what you need help with, but this might help:

I believe that the 28BYJ-48 has a lot more steps per rotation, around 4000 I think. I had a few problems myself getting this to work. It also has four steps to cycle through, not 2.

Take a look at this library which has the 28BYJ-48 set to default. [CustomStepper][1]

  [1]: http://playground.arduino.cc/Main/CustomStepper


message:
Combine Code Arduino GSM Shield and Adafruit GPS Shield

I have a problem to combine both code for Arduino GSM Shield and Adafruit Ultime GPS Shield. I already change my code to the basic one like examples. I think i found the problem. The problem is when i want to do get request to the url/web.

**Here is the link to the Adafruit Ultimate GPS Shield.**
[Adafruit Library][1]
[Adafruit Ultimate GPS Shield Info][2]

My code base on example of Arduino GSM Library (GSM Web Client) and Adafruit GPS Library (Parsing)

**This is the code that make my code not working. If i put the code i do not receive any data at serial.**

![Blank Data at serial][3]

     // if you get a connection, report back via serial:
     if (client.connect(server, port))
     {
        Serial.println("connected");
       // Make a HTTP request:
       client.print("GET ");
       client.print(path);
       client.println(" HTTP/1.1");
       client.print("Host: ");
       client.println(server);
       client.println("Connection: close");
       client.println();
     }
     else
     {
      // if you didn't get a connection to the server:
      Serial.println("connection failed");
     }

**This is the basic code that working so far**

![Working Code][4]

    // ********************************************
    //   GPS Library
    // ********************************************
    #include <Adafruit_GPS.h>
    #include <SoftwareSerial.h>
    #include <stdlib.h>

    // ********************************************
    //   GSM Library
    // ********************************************
    #include <GSM.h>

    // ********************************************
    //   Sim Card Pin Number if available
    // ********************************************
    #define PINNUMBER ""

    // ********************************************
    //   Set Up APN data for GPRS Connection
    // ********************************************
    #define GPRS_APN       "Maxis" // replace your GPRS APN
    #define GPRS_LOGIN     "maxis"    // replace with your GPRS login
    #define GPRS_PASSWORD  "wap" // replace with your GPRS password

    // ********************************************
    //   Initialize GSM Library
    // ********************************************
    GSMClient client;
    GPRS gprs;
    GSM gsmAccess;

    // ********************************************
    //   Setup Arduino to browse URL/web through GPRS
    //   The code below will setup path like:
    //   http://arella.com.my/urltomysql.php?firstname=Muhammad&lastname=Faiz
    //   When Arduino browse the web, it will submit firstname:Muhammad
    //   and lastname:Faiz into database. I want to store GPS data into database       later
    // ********************************************
    char server[] = "arella.com.my";
    char path[] = "/urltomysql.php?firstname=Muhammad&lastname=Faiz";
    int port = 80; // port 80 is the default for HTTP

    // ********************************************
    //  Set Adafruit GPS to use software serial on pin
    //  D9 & D10 on Arduino. Use Jumper Wire from D7,D8 to D9,D10
    // ********************************************
    SoftwareSerial mySerial(10, 9);
    Adafruit_GPS GPS(&mySerial);

    // Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
    // Set to 'true' if you want to debug and listen to the raw GPS sentences.
    #define GPSECHO  false

    // this keeps track of whether we're using the interrupt
    // off by default!
    boolean usingInterrupt = false;
    void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy

    //***********************************************
    // convert NMEA GPS Format to Google Map Format
    //***********************************************
    int degLatInt, degLongInt;
    float minLatFloat, minLongFloat, googleMapsLat, googleMapsLong;
    char* lat_str = new char[10];
    char* long_str = new char[10];
    char degLatString[5], degLongString[5];

    void setup()
    {
       Serial.begin(115200);
       gsmAccess.begin(PINNUMBER);
       gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD);

       boolean notConnected = true;
       while(notConnected)
       {
          if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
             (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
             notConnected = false;
          else
          {
             Serial.println("Not connected");
             delay(1000);
          }
       }
       // If i enable the code below, my code not working.
       /* if (client.connect(server, port))
          {
          Serial.println("connected");
          // Make a HTTP request:
          client.print("GET ");
          client.print(path);
          client.println(" HTTP/1.1");
          client.print("Host: ");
          client.println(server);
          client.println("Connection: close");
          client.println();
      } */

     //***********************************************
     // Setup Adafruit GPS Shield
     //***********************************************
     // connect at 115200 so we can read the GPS fast enough and echo without  dropping chars
     // also spit it out

     Serial.println("Adafruit GPS library basic test!");

     // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
     GPS.begin(9600);

     // uncomment this line to turn on RMC (recommended minimum) and GGA (fix     data) including altitude
     GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
     // uncomment this line to turn on only the "minimum recommended" data
     //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
     // For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
     // the parser doesn't care about other sentences at this time

     // Set the update rate
     GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
     // For the parsing code to work nicely and have time to sort thru the data, and
     // print it out we don't suggest using anything higher than 1 Hz

     // Request updates on antenna status, comment out to keep quiet
     GPS.sendCommand(PGCMD_ANTENNA);

     // the nice thing about this code is you can have a timer0 interrupt go off
     // every 1 millisecond, and read data from the GPS for you. that makes the
     // loop code a heck of a lot easier!
     useInterrupt(true);

       delay(1000);
    }

    // Interrupt is called once a millisecond, looks for any new GPS data, and stores it
    SIGNAL(TIMER0_COMPA_vect) {
       char c = GPS.read();
       // if you want to debug, this is a good time to do it!
       #ifdef UDR0
       if (GPSECHO)
       if (c) UDR0 = c;
       // writing direct to UDR0 is much much faster than Serial.print
       // but only one character can be written at a time.
       #endif
    }

    void useInterrupt(boolean v) {
       if (v)
       {
          // Timer0 is already used for millis() - we'll just interrupt somewhere
          // in the middle and call the "Compare A" function above
          OCR0A = 0xAF;
          TIMSK0 |= _BV(OCIE0A);
          usingInterrupt = true;
       } else
       {
          // do not call the interrupt function COMPA anymore
          TIMSK0 &= ~_BV(OCIE0A);
          usingInterrupt = false;
       }
    }

    uint32_t timer = millis();

    void loop()                     // run over and over again
    {
       // if a sentence is received, we can check the checksum, parse it...
       if (GPS.newNMEAreceived()) {
       // a tricky thing here is if we print the NMEA sentence, or data
       // we end up not listening and catching other sentences!
       // so be very wary if using OUTPUT_ALLDATA and trytng to print out data
       //Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived()  flag to false

       if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag  to false
          return;  // we can fail to parse a sentence in which case we should just wait for another
       }

       // if millis() or timer wraps around, we'll just reset it
       if (timer > millis())  timer = millis();
       // approximately every 2 seconds or so, print out the current stats
       if (millis() - timer > 5000) {
          timer = millis(); // reset the timer

          Serial.print("\nTime: ");
          Serial.print(GPS.hour+8, DEC); Serial.print(':');
          Serial.print(GPS.minute, DEC); Serial.print(':');
          Serial.print(GPS.seconds, DEC); Serial.print('.');
          Serial.println(GPS.milliseconds);
          Serial.print("Date: ");
          Serial.print(GPS.day, DEC); Serial.print('/');
          Serial.print(GPS.month, DEC); Serial.print("/20");
          Serial.println(GPS.year, DEC);
          Serial.print("Fix: "); Serial.print((int)GPS.fix);
          Serial.print(" quality: "); Serial.println((int)GPS.fixquality);
          if (GPS.fix) {
             /////////// Latitude /////////////
             // Convert NMEA Latitude to String
             dtostrf(GPS.latitude, 7, 4, lat_str); //convert GPS.latitude from float to String. 7 - means 8 characters long ; 4 - means 4 decimal point

             // Get Degree substring from latitude String
            strncpy(degLatString, lat_str, 1); // Get Degree from Full Latitude String. Example 311.7799 - Get 3

            // Get Minutes substring from latitude String
            char* minLatString = lat_str + 1; // Move pointer up 1 position. Example 311.7799 will move to 11.7799

            // Convert Deg String to int
            degLatInt = atoi(degLatString);

            // COnvert Min String to float
            minLatFloat = atof(minLatString);

            //Convert NMEA latitude to Google Maps latitude
            googleMapsLat = degLatInt + (minLatFloat / 60);
            Serial.print("Google Map Latitude: ");
            Serial.println(googleMapsLat, 4);

            //////////// Longitude /////////////
            // Convert NMEA Longitude to String
            dtostrf(GPS.longitude, 8, 4, long_str); //convert GPS.latitude from float to String. 8 - means 9 characters long ; 4 - means 4 decimal point

            // Get Degree substring from latitude String
            strncpy(degLongString, long_str, 3); // Get Degree from Full Latitude String. Example 10141.91699 - Get 141

            // Get Minutes substring from latitude String
            char* minLongString = long_str + 3; // Move pointer up 3 position. Example 10141.9169 will move to 41.7799

            // Convert Deg String to int
            degLongInt = atoi(degLongString);

            // COnvert Min String to float
            minLongFloat = atof(minLongString);

            //Convert NMEA latitude to Google Maps latitude
            googleMapsLong = degLongInt + (minLongFloat / 60);
            Serial.print("Google Map Longitude: ");
            Serial.println(googleMapsLong, 4);

            Serial.print("Speed (KM): "); Serial.println(GPS.speed * 1.85);
          }
       }
    }

  [1]: https://github.com/adafruit/Adafruit-GPS-Library
  [2]: https://learn.adafruit.com/adafruit-ultimate-gps-logger-shield
  [3]: https://i.stack.imgur.com/DhQqd.png
  [4]: https://i.stack.imgur.com/ngvU7.png

body:
I'm working on the same project (with the same hardware) and I have an identical problem.
Seems like an HTTP request blows up your serial monitor, but is not true in my view.
In fact, if you use the TinyGPS++ library will not have this problem anymore.
Take as reference the GsmWebClient example, you can add a few lines of code.

This is all you need for parse with tinyGPS:

    #include <AltSoftSerial.h>

    #include <TinyGPS++.h>

    TinyGPSPlus gps;

    AltSoftSerial ss;

    //Add this to your sketch, in loop() or setup()

    ss.begin(9600);

    while (ss.available() > 0)

        if (gps.encode(ss.read())) {
            gps.location.lat(); //return latitude as a double
            gps.location.lng(); //return longitude as a double
    }