Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //UltrasonicDemo.ino
- #include "Ultrasonic.h"
- void setup(){
- Serial.begin(SerialBaudRate); //115200
- while (!Serial) {delay(10);} //wait for serial to wake up
- UltrasonicSetup();
- }
- void loop(){
- UltrasonicLoop();
- }
- *********************************************
- //Excerpts from Ultrasonic.cpp
- void UltrasonicSetup() {
- Serial.begin(SerialBaudRate); //115200
- while (!Serial) {delay(10);} //wait for serial to wake up
- D_show_cursor(false); //disable cursor on display
- D_cls();
- D_position(0, 0);
- Serial.print(F("Ultrasonic library loaded"));
- pinMode(TRIGGER_PIN, OUTPUT); //TRIG(speaker pin)
- pinMode(ECHO_PIN, INPUT); //ECHO(microphone pin)
- attachInterrupt (digitalPinToInterrupt (ECHO_PIN), USInterruptTimer, CHANGE); //interrupt routine setup
- //attachPCINT(digitalPinToPCINT(ECHO_PIN), InterruptTimer, CHANGE); //when using PinChangeInterrupt.h
- delay(1000);
- D_cls();
- }
- *********************************************
- void UltrasonicSetup() {
- Serial.begin(SerialBaudRate); //115200
- while (!Serial) {delay(10);} //wait for serial to wake up
- D_show_cursor(false); //disable cursor on display
- D_cls();
- D_position(0, 0);
- Serial.print(F("HUGUltrasonic library loaded"));
- pinMode(TRIGGER_PIN, OUTPUT); //TRIG(speaker pin)
- pinMode(ECHO_PIN, INPUT); //ECHO(microphone pin)
- attachInterrupt (digitalPinToInterrupt (ECHO_PIN), USInterruptTimer, CHANGE); //interrupt routine setup
- //attachPCINT(digitalPinToPCINT(ECHO_PIN), InterruptTimer, CHANGE); //when using PinChangeInterrupt.h
- delay(1000);
- D_cls();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement