Page 150 - KEC Khaitan C6 Flipbook
P. 150

Code:
























                  Quick Tips:

                     ∑  Stable Mounting: Secure the ultrasonic sensor firmly to prevent inaccurate readings caused
                      by sensor movement.
                     ∑  Cable Management: Neatly arrange and tape down wires to avoid disconnections during
                      operation.
                     ∑  Battery Check: Use fully charged batteries to ensure the servo motor operates smoothly.
                      Weak batteries may cause the lid to malfunction.

                     ∑  Testing Thresholds: Adjust the detection distance threshold in the code if the lid opens or
                      closes unexpectedly.

                  Troubleshoot:

                      Lid Doesn't Open/Close:
                      ◦      Ensure the  ultrasonic  sensor connections (Trig and  Echo)  are correctly  wired  to  the
                          Micro:bit.
                      ◦     Verify the servo motor is connected to the correct pin (P2) and receiving power.

                      ◦     Check the battery pack for sufficient charge.
                      Inaccurate Detection:
                      ◦     Make sure the ultrasonic sensor is aligned properly and not obstructed by dustbin edges.

                      ◦     Adjust the sensor’s angle for better object detection.
                      Servo Motor Jitter:
                      ◦      Reduce jitter by adding a short delay between servo movements (e.g., pause 100 in the

                          code).
                      ◦      Ensure  the  servo motor  is  compatible  with  the  Micro:bit  and  can  handle  continuous
                          rotation.
                      WiFi Module Not Responding (Optional):
                      ◦      Double-check UART connections (P13 for TX, P14 for RX) and verify that the module is
                          powered correctly.




                  148   Premium Edition-VI
   145   146   147   148   149   150   151   152   153   154   155