element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Using serial communication without pc
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 35 replies
  • Answers 5 answers
  • Subscribers 394 subscribers
  • Views 5027 views
  • Users 0 members are here
  • arduino
Related

Using serial communication without pc

Former Member
Former Member over 11 years ago

I just started using the arduino and tried to build a remote control car. I have used the 434MHz RF module for radio transmission. I made a program for both remote and the receiver in the car, it worked fine when I tested it using my pc to send and receive signals. since I used the serial communication, it didn't work when I disconnected the arduinos from my pc. Is there a way to use the serial communication even when it is not connected to the pc, if it can be done, please suggest a way to do so.

  • Sign in to reply
  • Cancel

Top Replies

  • alexev
    alexev over 11 years ago in reply to Former Member +1
    There are many considerations to take in account: -instead of using "serial.print" which is a display command, try using "serial.write" to transmit data ( http://arduino.cc/en/Serial/Print#.UyoIPIXPsvw…
  • Robert Peter Oakes
    Robert Peter Oakes over 9 years ago in reply to elizabethmath +1 suggested
    I just checked with a sketch The serial lights TX or RX do not flicker when the USB is not connected, you can see that the USB Controller knows when the USB is connected and also that the lights are controlled…
  • Robert Peter Oakes
    Robert Peter Oakes over 9 years ago in reply to elizabethmath +1 suggested
    How were yo planning on using the scanner in the original design without the PC ? Suggestions would be LCD Display either attached via I2C or even via the hardware serial port but connected to pins 0,1…
  • Former Member
    0 Former Member over 9 years ago in reply to DAB

    Thanks DAB,

    This info is really helpful for me.

    What I do the power given by 9v battery....and its work.

    Thank you very much.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • elizabethmath
    0 elizabethmath over 9 years ago in reply to alexev

    Hi,

    Sorry, I'm quite new to the arduino( and electronic) platform, so apologies in advance if my queries seem silly.

    But does that mean i would need to replace the serial.print commands with serial.write or since I would no longer require the laptop interface, can I just get rid of all the serial.print commands in my code?

     

    I am working on getting rid of my laptop interface and just uploading the code onto my arduino board. unfortunately, even after getting rid of all the serial.print commands while retaining all the other essential parts of the code, I dont seem to have it working without the usb to pc connection.

    May I know what I'm doing wrong? Am I expected to ADD certain code now ( like the serial.write command) into my code now?

     

    Many thanks for any help with regard to me query! image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • neilk
    0 neilk over 9 years ago in reply to elizabethmath

    Hi elizabethmath

     

    I think we need to know a little bit more about what you are trying to do with your Arduino program.

     

    A block diagram and/or your code would be very helpful.

     

    Neil

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago in reply to elizabethmath

    Please provide the sketch your using,

     

    There is no reason you need the PC connected to run you sketch but there may be something in you code that will help us to help you

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • D_Hersey
    0 D_Hersey over 9 years ago

    I feel so pedantic saying this, but:

     

          if(temp1!=0)

     

           

    might be able to be re-written as:

     

          if(temp1)

     

    and I am having a little trouble grasping the control flow here:

     

          if(temp1!=0)

          {

        

            if(temp==0){

            digitalWrite(temp1,LOW);         

            }

     

    is this unreachable code?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago in reply to D_Hersey

    You are correct, it would be unreachable but the compiler may not pick up on it

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • D_Hersey
    0 D_Hersey over 9 years ago

    I've been coding lately after a long hiatus, but on bigger machines.  Do micro-controller compilers implement the 'volitile' keyword?  I do not see it very often in code samples on element14.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago in reply to D_Hersey

    a lot of them do support it but not too many members fall into the "Advanced" camp where it would make more difference and have more meaning. Perhaps you could provide a blog as to why people should and could use the "Volatile" keyword for declarations of methods and variables.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • D_Hersey
    0 D_Hersey over 9 years ago

    In this circumstance, 'volitile' prefix tells the compiler that the variable may change spontaneously outside of the current code.  This could be because another thread of execution can change it, or it is reading a hardware input line.  Now, the compiler won't generate spurious 'unreachable code' warnings in this context.  It is also a good reminder to the reader about the special nature of these variables. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • D_Hersey
    0 D_Hersey over 9 years ago

    Doing a moments digging on the interweb tells me that 'volatile' also retards automatic p-code optimization.  If I were to type something like:

     

    int N =0;

    while (N != Magic_Number_1){}

     

    when N is asynchronously and independently loaded by another thread or the I/O subsystem, the optomiser might be fooled into interpreting this as:

     

    while(1){}

     

    so,

     

    volatile int N =0;

     

    prevents this.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube