element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • 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
microbit
  • Learn
  • Learning Center
  • STEM Academy
  • microbit
  • More
  • Cancel
microbit
microbit Forum Rotation, Roll sensor, that is adjustable. A buzzer that will let you know when the RC truck is about to roll over.
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
microbit requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 1 reply
  • Subscribers 35 subscribers
  • Views 215 views
  • Users 0 members are here
Related

Rotation, Roll sensor, that is adjustable. A buzzer that will let you know when the RC truck is about to roll over.

BenchMade
BenchMade 12 days ago

I would like to know the steps on how to capture the role of an RC vehicle,  before it is about to roll on its side.  The micro:bit can be placed on the RC vehicle on the roll axis.

Micro:bit will be placed on the RC truck,  Roll axis .  Then A switch will Capture 0 value of the roll value.  Then the RC truck will be tilted at 90° or whatever the role value is, before it tips over.


Here is what I have on my micro:bit,  to capture the data when the air switch is pressed.  And when the B button is pressed down, it captures the angle of the roll.

what I don’t know is how to include the buzzer so when it gets to the point of the data captured on the B switch, it will start buzzing.

image

 

There is a YouTube example.


www.youtube.com/watch

  • Sign in to reply
  • Cancel

Top Replies

  • beacon_dave
    beacon_dave 10 days ago +1
    One way might be: In the main program loop, forever compare the current rotation angle with the tilt value stored by button B and if it is greater than or equal to, then turn the buzzer on, else turn…
  • beacon_dave
    0 beacon_dave 10 days ago

    One way might be:

    In the main program loop, forever compare the current rotation angle with the tilt value stored by button B and if it is greater than or equal to, then turn the buzzer on, else turn the buzzer off.

    There is an example here which may help:
    https://makecode.microbit.org/reference/input/rotation

    Note that you may want to disable the buzzer until button B has stored the desired tilt threshold value otherwise the buzzer may start sounding before button B has been set. You could also initialise the tilt threshold value to a very high tilt value and then pressing button B effectively lowers it.

    Also you appear to be measuring pitch and not roll in your code. This may be intentional due to the orientation of the micro:bit on the vehicle.

    If you are just starting out with the micro:bit then you may be interested in getting hold of a copy of this book:
    https://www.mheducation.co.uk/save-the-world-with-code-20-fun-projects-for-all-ages-using-raspberry-pi-micro-bit-and-circuit-9781260457599-emea

    or perhaps taking a look at the Physical Computing course on FutureLearn:
    https://www.futurelearn.com/courses/build-a-physical-computing-prototype
    where if I recall correctly, the final project is a remote control car using two micro:bits

    • Cancel
    • Vote Up +1 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 © 2023 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