Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Famulus · Aug 22, 2012 at 05:16 PM · arduinoportio

delay sending to serial port

Hi

I've managed to get a script to send a stream of single digits from a scene to an Arduino board, so that a different LED lights up for each digit. However, there is a significant delay after the first light, and most of the sequence of lights happens after I close the scene. (Working in Play mode, with the signals being sent from a function called in Update).

Can anyone suggest why there should be such a delay please? If I send a fixed string of digits (eg 01234567) from the Start function, it works fine, it's only in the Update function that the delay happens.

The following function is called from Update() with the digit to be sent to Arduino as 'number'. sp is a public Serial Port object that has been opened and seems to work OK; the sp.Write is the command I'm concerned with. (The rest of the function sends information to GUIText just so I can see what's going on).

public void sendToArduino(string number){ sp.Write(number); message = "Direction " + number + ", Time " + Time.time; orientation.SendMessage("ShowMessage", message); }

PS: I've flagged this as code, but it's lost the layout - is that how it should appear? :0)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Famulus · Aug 23, 2012 at 09:11 AM

OK - I think I've cracked it, by using a timer to send to Arduino at fixed intervals. I knew I'd need to do that for other reasons, but didn't realise that it would help with this problem.

So I've set a timer to count up, and only send to Arduino when it reaches 1 second, then reset the timer to 0. All I need to do now is play around with it, to work out how small an interval is viable for what I need to do.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Uniduino, Arduino & Unity 5 3 Answers

Serial Port delay is getting longer 0 Answers

Send data through usb using android phone 0 Answers

Arduino with Unity: Bad Framerate! 3 Answers

Trying to read an integer value from ReadLine() 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges