Advertisement
Guest User

elecCodePortion

a guest
Oct 24th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. Code timeline
  2. Week 1 (week 7)
  3. -Code for bluetooth send function implemented.
  4. *No other code written as idea changes made
  5. Week 2 (week 8)
  6. -Code for flexible resistors written, tested to be faulty. Re-written so that only one input could be taken at a time.
  7. -Code for converting input from resistors to a char implemented
  8. Week 3(week 9)
  9. -Complete weight station code written (Initially meant to be part of slave unit)
  10. -Calibration and editing of flexible resistor code progress(not completed)
  11. Week 4(week 10)
  12. -Bluetooth function modified slightly to try fix communication problems, delays and also order changed for some code
  13. -Weight station Code separated to separate file; Requires extra arduino
  14. -DC motor code written(unreliable, thought to be faulty soldering of H-bridge)
  15. Week 5(week 11)
  16. -Flexible resistor code scrapped, replaced with buttons.(working individually, but all 5 required would not work)
  17. -Further changes to bluetooth sending (changing to buttons requried different format)
  18. Week 6 (week 12)
  19. -Code changed for bluetooth controller multiple times (unsuccessful, unable to receive correct values)
  20. *Project deemed unable to complete. Replaced with working demo made in week 7.
  21.  
  22. Pseudocode for final product
  23. The implementation we intended is not use for the demo, this was planned to be used.
  24.  
  25. Arduino 1 : master (the controller for the robot)
  26. Inital :
  27. Store slave address for specific module;
  28.  
  29. Setup():
  30. Run a setup function, connecting the bluetooth devices
  31. -Setup serialmonitor to 9600 baud
  32. -Setup bluetTooth: pins for input/output
  33. -Setup analogue pins for flexible resistors to Input
  34.  
  35. loop():
  36. Declare a char to store received char from slave
  37. Declare for each direction of movement(forward, back, left, right) and scoop control to a float value, map the value from the flexible resistor.
  38. If resistance value for movement is greater than 0: Store this movement, increment counter
  39. If counter equals 1, send via bluetooth movement char (Only one movement at a time)
  40.  
  41. Arduino 2: slave (receives instructions from master, does all actions)
  42. *This includes DC_motor code, where the dcmotor is controling the scoop
  43. Initial:
  44. Declare the servo motors for movement and bluetooth comparator, initialise comparator to 0 (for first iteration)
  45.  
  46. setup():
  47. Setup bluetooth and bluetooth
  48. Setup bluetooth function used
  49.  
  50. loop():
  51. Declare a received char(used for storing bluetooth input char, and accessing it for each loop)
  52. Inside an infinite loop, when possible to take value from bluetooth:
  53. Update the value of received char
  54. Print to serial monitor the char (to see if received char is correct)
  55.  
  56. In multiple if statements, one for each form of movement (forward, back, left, right)
  57. Move the corresponding servo motors maximum speed.
  58. Detatch the servos
  59. Send received char back to master( to check it has sent correct char) Loop resets
  60.  
  61. Arduino3: Weighing station (weigh an object, display weight/price based on object
  62. Initial:
  63. Import/include required packages for LCD and weighing scale
  64. Setup pins for the LCD and scale
  65.  
  66.  
  67. Setup():
  68. Setup the serial monitor
  69. Start LCD and set pins
  70.  
  71. Loop();
  72. *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
  73. Use get weight function and print to LCD
  74. print to LCD letter g(as unit is grams)
  75. print to LCD white space( 2 rows)
  76. **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