-
Type your title
04/17/2018 at 13:20 • 0 commentsThere's not really much to put here, mainly because it's so simple. Literally ryan's build, with a SRF04 hot glued on the front, wired up to the nano. It's just the code that's going to be a bitch. I haven't tried turning it, only going forwards and backwards, so that'll be fun.
I'm pretty proud of this one- I was ONE jumper wire short. i needed a female to male one, but i couldn't find it, so i soldered a wire to the end of a single female header, and covered it with heat shrink.
One more thing, i have a newfound hate for those cheap little servos. I think i've had to replace two, just because the gears wear down or something. Maybe i should cnc some metal ones...
I suck at coding, so thanks to this project: #Bracelet Dodges Obstacles, i'll be using that to base my code off of:
#define echo 8 #define trig 7 long duration,distance; void setup() { Serial.begin(9600); pinMode(echo,INPUT); pinMode(trig,OUTPUT); pinMode(5,OUTPUT); } void loop() { digitalWrite(trig,LOW); delayMicroseconds(2); digitalWrite(trig,HIGH); delayMicroseconds(10); digitalWrite(trig,LOW); duration=pulseIn(echo,HIGH); distance=(duration/(2*29)); if(distance>=500 || distance<=0){ Serial.println("____"); } else{ Serial.print(distance); Serial.println("cm."); digitalWrite(5,LOW); } if(distance<=45 && distance>=1){// distance in which the bracelet vibrates, you can edit according to your need digitalWrite(5,HIGH); Serial.println("Alarm!!!"); } delay(400); }