ATMEGA328P-PU takes upload, but cannot communicate through SerialBaud rates for stable Bluetooth serial communicationPython Serial Communication Using HC-05 Connected to OS X Version 10.11.1 (15B42)arduino uno serial communicationJava RXTX - Detecting the right device through serial communicationHM-10 returns Euro symbolArduino communication through serial monitorAndroid app not synchronized with Arduino Serial communicationI cannot send data to my Arduino through usb serial connectionSerial Connection ATMEGA328pReplicating Arduino's serial communication on atmega328p

Plastic-on-plastic lubricant that wont leave a residue?

Should pressure only be applied at the top of a pastry bag?

How to make a language evolve quickly?

Early arrival in Australia, early hotel check in not available

Why was Thor doubtful about his worthiness to Mjolnir?

Why did the ICC decide not to probe alleged US atrocities in Afghanistan?

What are the components of a legend (in the sense of a tale, not a figure legend)?

tikz: not so precise graphic

Extracting sublists that contain similar elements

How to slow yourself down (for playing nice with others)

Why was castling bad for white in this game, and engine strongly prefered trading queens?

Where's this in Lillooet BC?

A cryptic tricolour

Who was this character from the Tomb of Annihilation adventure before they became a monster?

Exception propagation: When should I catch exceptions?

Why in a Ethernet LAN, a packet sniffer can obtain all packets sent over the LAN?

Two researchers want to work on the same extension to my paper. Who to help?

Can I use my laptop, which says 100-240V, in the USA?

Definition of Newton's first law

Create a list of all possible Boolean configurations of three constraints

Ex-manager wants to stay in touch, I don't want to

Smallest Guaranteed hash collision cycle length

How can a layman easily get the consensus view of what academia *thinks* about a subject?

What food production methods would allow a metropolis like New York to become self sufficient



ATMEGA328P-PU takes upload, but cannot communicate through Serial


Baud rates for stable Bluetooth serial communicationPython Serial Communication Using HC-05 Connected to OS X Version 10.11.1 (15B42)arduino uno serial communicationJava RXTX - Detecting the right device through serial communicationHM-10 returns Euro symbolArduino communication through serial monitorAndroid app not synchronized with Arduino Serial communicationI cannot send data to my Arduino through usb serial connectionSerial Connection ATMEGA328pReplicating Arduino's serial communication on atmega328p






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I am using Standalone ATMEGA328P-PU to get the accelerometer data from mpu6050 and send to to Serial at baudrate 115200 and also it sends the data to another serial(to HC05 bluetooth module). But the problem is that sometimes I am facing a strange scenerio, the atmega328p-pu accepts program through usb to ttl converter, but the controller cannot send any data through serial. The serial data in both hc05 bluetooth and usb serial are blank. Anyone knows any possible reasons for that. I am using the following code.



I have tried checking the connections on veroboard, but this situation sometimes fix, and sometimes reappear.



#include <SoftwareSerial.h>
#include "I2Cdev.h" // include the I2Cdev library
#include "MPU6050.h" // include the accelerometer library

SoftwareSerial bt(3,4); /* (Rx,Tx) */
MPU6050 accelgyro; // set device to MPU6050
int16_t ax, ay, az, gx, gy, gz; // define accel as ax,ay,az
int baselineX = 0;

void setup()
Wire.begin(); // join I2C bus
Serial.begin(115200); // initialize serial communication
bt.begin(9600);
accelgyro.initialize(); // initialize the accelerometer
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
baselineX = gz;

void loop()
// read measurements from device
sendAverage();


long sendAverage()
long totalX = 0, totalY = 0, totalZ = 0;
long X, Y, Z;
for (int i = 0; i < 20; i++)
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
totalX = totalX + ax;
totalY = totalY + ay;
totalZ = totalZ + az;
delay(1);

X = 500+ ((totalX/20)*0.05);
Y = 500+ ((totalY/20)*0.05);
Z = 500+ ((totalZ/20)*0.05);

Serial.print(X);Serial.print(";");
Serial.print(Y);Serial.print(";");
Serial.println(Z);

bt.print(X);bt.print(";");
bt.print(Y);bt.print(";");
bt.print(Z);bt.print("#");











share|improve this question




























    2















    I am using Standalone ATMEGA328P-PU to get the accelerometer data from mpu6050 and send to to Serial at baudrate 115200 and also it sends the data to another serial(to HC05 bluetooth module). But the problem is that sometimes I am facing a strange scenerio, the atmega328p-pu accepts program through usb to ttl converter, but the controller cannot send any data through serial. The serial data in both hc05 bluetooth and usb serial are blank. Anyone knows any possible reasons for that. I am using the following code.



    I have tried checking the connections on veroboard, but this situation sometimes fix, and sometimes reappear.



    #include <SoftwareSerial.h>
    #include "I2Cdev.h" // include the I2Cdev library
    #include "MPU6050.h" // include the accelerometer library

    SoftwareSerial bt(3,4); /* (Rx,Tx) */
    MPU6050 accelgyro; // set device to MPU6050
    int16_t ax, ay, az, gx, gy, gz; // define accel as ax,ay,az
    int baselineX = 0;

    void setup()
    Wire.begin(); // join I2C bus
    Serial.begin(115200); // initialize serial communication
    bt.begin(9600);
    accelgyro.initialize(); // initialize the accelerometer
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
    baselineX = gz;

    void loop()
    // read measurements from device
    sendAverage();


    long sendAverage()
    long totalX = 0, totalY = 0, totalZ = 0;
    long X, Y, Z;
    for (int i = 0; i < 20; i++)
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
    totalX = totalX + ax;
    totalY = totalY + ay;
    totalZ = totalZ + az;
    delay(1);

    X = 500+ ((totalX/20)*0.05);
    Y = 500+ ((totalY/20)*0.05);
    Z = 500+ ((totalZ/20)*0.05);

    Serial.print(X);Serial.print(";");
    Serial.print(Y);Serial.print(";");
    Serial.println(Z);

    bt.print(X);bt.print(";");
    bt.print(Y);bt.print(";");
    bt.print(Z);bt.print("#");











    share|improve this question
























      2












      2








      2








      I am using Standalone ATMEGA328P-PU to get the accelerometer data from mpu6050 and send to to Serial at baudrate 115200 and also it sends the data to another serial(to HC05 bluetooth module). But the problem is that sometimes I am facing a strange scenerio, the atmega328p-pu accepts program through usb to ttl converter, but the controller cannot send any data through serial. The serial data in both hc05 bluetooth and usb serial are blank. Anyone knows any possible reasons for that. I am using the following code.



      I have tried checking the connections on veroboard, but this situation sometimes fix, and sometimes reappear.



      #include <SoftwareSerial.h>
      #include "I2Cdev.h" // include the I2Cdev library
      #include "MPU6050.h" // include the accelerometer library

      SoftwareSerial bt(3,4); /* (Rx,Tx) */
      MPU6050 accelgyro; // set device to MPU6050
      int16_t ax, ay, az, gx, gy, gz; // define accel as ax,ay,az
      int baselineX = 0;

      void setup()
      Wire.begin(); // join I2C bus
      Serial.begin(115200); // initialize serial communication
      bt.begin(9600);
      accelgyro.initialize(); // initialize the accelerometer
      accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
      baselineX = gz;

      void loop()
      // read measurements from device
      sendAverage();


      long sendAverage()
      long totalX = 0, totalY = 0, totalZ = 0;
      long X, Y, Z;
      for (int i = 0; i < 20; i++)
      accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
      totalX = totalX + ax;
      totalY = totalY + ay;
      totalZ = totalZ + az;
      delay(1);

      X = 500+ ((totalX/20)*0.05);
      Y = 500+ ((totalY/20)*0.05);
      Z = 500+ ((totalZ/20)*0.05);

      Serial.print(X);Serial.print(";");
      Serial.print(Y);Serial.print(";");
      Serial.println(Z);

      bt.print(X);bt.print(";");
      bt.print(Y);bt.print(";");
      bt.print(Z);bt.print("#");











      share|improve this question














      I am using Standalone ATMEGA328P-PU to get the accelerometer data from mpu6050 and send to to Serial at baudrate 115200 and also it sends the data to another serial(to HC05 bluetooth module). But the problem is that sometimes I am facing a strange scenerio, the atmega328p-pu accepts program through usb to ttl converter, but the controller cannot send any data through serial. The serial data in both hc05 bluetooth and usb serial are blank. Anyone knows any possible reasons for that. I am using the following code.



      I have tried checking the connections on veroboard, but this situation sometimes fix, and sometimes reappear.



      #include <SoftwareSerial.h>
      #include "I2Cdev.h" // include the I2Cdev library
      #include "MPU6050.h" // include the accelerometer library

      SoftwareSerial bt(3,4); /* (Rx,Tx) */
      MPU6050 accelgyro; // set device to MPU6050
      int16_t ax, ay, az, gx, gy, gz; // define accel as ax,ay,az
      int baselineX = 0;

      void setup()
      Wire.begin(); // join I2C bus
      Serial.begin(115200); // initialize serial communication
      bt.begin(9600);
      accelgyro.initialize(); // initialize the accelerometer
      accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
      baselineX = gz;

      void loop()
      // read measurements from device
      sendAverage();


      long sendAverage()
      long totalX = 0, totalY = 0, totalZ = 0;
      long X, Y, Z;
      for (int i = 0; i < 20; i++)
      accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
      totalX = totalX + ax;
      totalY = totalY + ay;
      totalZ = totalZ + az;
      delay(1);

      X = 500+ ((totalX/20)*0.05);
      Y = 500+ ((totalY/20)*0.05);
      Z = 500+ ((totalZ/20)*0.05);

      Serial.print(X);Serial.print(";");
      Serial.print(Y);Serial.print(";");
      Serial.println(Z);

      bt.print(X);bt.print(";");
      bt.print(Y);bt.print(";");
      bt.print(Z);bt.print("#");








      arduino arduino-uno usbserial mpu6050 hc-05






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 11:52









      Agniva DuttaAgniva Dutta

      175




      175






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You're using the SoftwareSerial class to change the pins for the serial transmission, but in the setup() you're not setting the properties of the two pins. If you want to transmit through the SoftwareSerial class, add the pinMode :



          SoftwareSerial bt = SoftwareSerial(rxPin, txPin);

          void setup()
          // define pin modes for tx, rx of SoftwareSerial:
          pinMode(3, INPUT);
          pinMode(4, OUTPUT);
          // set the data rate for the SoftwareSerial port
          bt.begin(9600);



          For a complete reference, see the SoftwareSerial.begin documentation page






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55313446%2fatmega328p-pu-takes-upload-but-cannot-communicate-through-serial%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You're using the SoftwareSerial class to change the pins for the serial transmission, but in the setup() you're not setting the properties of the two pins. If you want to transmit through the SoftwareSerial class, add the pinMode :



            SoftwareSerial bt = SoftwareSerial(rxPin, txPin);

            void setup()
            // define pin modes for tx, rx of SoftwareSerial:
            pinMode(3, INPUT);
            pinMode(4, OUTPUT);
            // set the data rate for the SoftwareSerial port
            bt.begin(9600);



            For a complete reference, see the SoftwareSerial.begin documentation page






            share|improve this answer



























              0














              You're using the SoftwareSerial class to change the pins for the serial transmission, but in the setup() you're not setting the properties of the two pins. If you want to transmit through the SoftwareSerial class, add the pinMode :



              SoftwareSerial bt = SoftwareSerial(rxPin, txPin);

              void setup()
              // define pin modes for tx, rx of SoftwareSerial:
              pinMode(3, INPUT);
              pinMode(4, OUTPUT);
              // set the data rate for the SoftwareSerial port
              bt.begin(9600);



              For a complete reference, see the SoftwareSerial.begin documentation page






              share|improve this answer

























                0












                0








                0







                You're using the SoftwareSerial class to change the pins for the serial transmission, but in the setup() you're not setting the properties of the two pins. If you want to transmit through the SoftwareSerial class, add the pinMode :



                SoftwareSerial bt = SoftwareSerial(rxPin, txPin);

                void setup()
                // define pin modes for tx, rx of SoftwareSerial:
                pinMode(3, INPUT);
                pinMode(4, OUTPUT);
                // set the data rate for the SoftwareSerial port
                bt.begin(9600);



                For a complete reference, see the SoftwareSerial.begin documentation page






                share|improve this answer













                You're using the SoftwareSerial class to change the pins for the serial transmission, but in the setup() you're not setting the properties of the two pins. If you want to transmit through the SoftwareSerial class, add the pinMode :



                SoftwareSerial bt = SoftwareSerial(rxPin, txPin);

                void setup()
                // define pin modes for tx, rx of SoftwareSerial:
                pinMode(3, INPUT);
                pinMode(4, OUTPUT);
                // set the data rate for the SoftwareSerial port
                bt.begin(9600);



                For a complete reference, see the SoftwareSerial.begin documentation page







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 12:20









                pittixpittix

                10110




                10110





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55313446%2fatmega328p-pu-takes-upload-but-cannot-communicate-through-serial%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript