Skip to content

pappavis/pxt-sonar-i2c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pxt-sonar-i2c Build Status

'n makecode pakket om sonar sensore (ping) soos HC-SR04met I2C uitbreiding PCF8574 te gebruik.

Gewysigd deur #easylab4kids

Gebruik

This package contains a ping block that can return the distance to an obstacle detected by the sonar.

sonar.ping(DigitalPin.P1, DigitalPin.P2, PingUnit.Inches);

Charting the distance

Use the plot bar graph block to visualize the distance reported by your sensor.

basic.forever(() => {
    let p = sonar.ping(DigitalPin.P1, DigitalPin.P2, PingUnit.Inches);
    led.plotBarGraph(p, 0);
})

License

MIT

Supported targets

  • for PXT/microbit
  • for PXT/calliope
  • for PXT/Circuit Playground Express

(The metadata above is needed for package search.)

## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.



I2C versie door Michiel Erasmus #easylab4kids