Input Devices


#magnet sensor


Trulli

This week, I try to use magnet sensor. I may utilize the sensor for my final project to measure the angle of the robot


Hall effect


Trulli

The hall effect sensor is a type of magnetic sensor which can be used for detecting the strength and direction of a magnetic field produced from a permanent magnet or an electromagnet with its output varying in proportion to the strength of the magnetic field being detected.


Trulli

Trulli

the example needs a adapter for uploading the bootloader whith previous programmer; therefore, I made one.


TEST



The following is the code I used

#define nsamples 100

void setup() {
   //
   // start serial
   //
   SerialUSB.begin(9600);
   }

void loop() {
   uint32_t result = 0;
   //
   // accumulate readings
   ///
   for (int count = 0; count < nsamples; ++count)
     result += analogRead(2);
   //
   // send framing
   //
   for (int i = 0; i < result/1000; ++i)
     SerialUSB.print("▀");
   SerialUSB.println("▀");

   }


GROUP ASSIGNMENT


Nov 02 2022