Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code timeline
- Week 1 (week 7)
- -Code for bluetooth send function implemented.
- *No other code written as idea changes made
- Week 2 (week 8)
- -Code for flexible resistors written, tested to be faulty. Re-written so that only one input could be taken at a time.
- -Code for converting input from resistors to a char implemented
- Week 3(week 9)
- -Complete weight station code written (Initially meant to be part of slave unit)
- -Calibration and editing of flexible resistor code progress(not completed)
- Week 4(week 10)
- -Bluetooth function modified slightly to try fix communication problems, delays and also order changed for some code
- -Weight station Code separated to separate file; Requires extra arduino
- -DC motor code written(unreliable, thought to be faulty soldering of H-bridge)
- Week 5(week 11)
- -Flexible resistor code scrapped, replaced with buttons.(working individually, but all 5 required would not work)
- -Further changes to bluetooth sending (changing to buttons requried different format)
- Week 6 (week 12)
- -Code changed for bluetooth controller multiple times (unsuccessful, unable to receive correct values)
- *Project deemed unable to complete. Replaced with working demo made in week 7.
- Pseudocode for final product
- The implementation we intended is not use for the demo, this was planned to be used.
- Arduino 1 : master (the controller for the robot)
- Inital :
- Store slave address for specific module;
- Setup():
- Run a setup function, connecting the bluetooth devices
- -Setup serialmonitor to 9600 baud
- -Setup bluetTooth: pins for input/output
- -Setup analogue pins for flexible resistors to Input
- loop():
- Declare a char to store received char from slave
- Declare for each direction of movement(forward, back, left, right) and scoop control to a float value, map the value from the flexible resistor.
- If resistance value for movement is greater than 0: Store this movement, increment counter
- If counter equals 1, send via bluetooth movement char (Only one movement at a time)
- Arduino 2: slave (receives instructions from master, does all actions)
- *This includes DC_motor code, where the dcmotor is controling the scoop
- Initial:
- Declare the servo motors for movement and bluetooth comparator, initialise comparator to 0 (for first iteration)
- setup():
- Setup bluetooth and bluetooth
- Setup bluetooth function used
- loop():
- Declare a received char(used for storing bluetooth input char, and accessing it for each loop)
- Inside an infinite loop, when possible to take value from bluetooth:
- Update the value of received char
- Print to serial monitor the char (to see if received char is correct)
- In multiple if statements, one for each form of movement (forward, back, left, right)
- Move the corresponding servo motors maximum speed.
- Detatch the servos
- Send received char back to master( to check it has sent correct char) Loop resets
- Arduino3: Weighing station (weigh an object, display weight/price based on object
- Initial:
- Import/include required packages for LCD and weighing scale
- Setup pins for the LCD and scale
- Setup():
- Setup the serial monitor
- Start LCD and set pins
- Loop();
- *Scale is in unit of gram, using a fruit as example cost taken, to make this weight: make the *rate for object 1; to give in grams
- Use get weight function and print to LCD
- print to LCD letter g(as unit is grams)
- print to LCD white space( 2 rows)
- **Code can be edited to distinguish between adding cost rate or to just measure mass: this **just measures and displays the mass.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement