granular_gripper
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
granular_gripper [2019/07/29 15:05] – yuhanghe | granular_gripper [2019/07/29 16:22] (current) – [Final Words] yuhanghe | ||
---|---|---|---|
Line 112: | Line 112: | ||
{{ : | {{ : | ||
The following figure shows the actual circuit implemented with Arduino and a prototype board. | The following figure shows the actual circuit implemented with Arduino and a prototype board. | ||
+ | {{ : | ||
+ | |||
==== Programming ==== | ==== Programming ==== | ||
- | A link to the source code can be found <provide URL to your code, probably saved in this DASL Wiki>. | + | A link to the source code can be found {{: |
\\ | \\ | ||
- | The goal of the code is <brief explanation> | + | <code cpp | Switch.ino> |
- | \\ | + | String input; // for incoming serial data |
- | ---- | + | int command; |
- | <!- Insert | + | bool vac = false; //Switch condition for vacuum |
- | ---- | + | bool blow = false; //Switch condition for blow off |
- | \\ | + | bool off = true; //Switch condition for off |
- | The snippet above serves to <fill in the blank>. It does this by <fill in the blank>. | + | |
- | \\ | + | void setup() { |
- | ---- | + | Serial.begin(9600); |
- | <!- Insert another snippet of your code here. | + | pinMode(8, OUTPUT); //Assign port 8 and 9 as digital output |
- | ---- | + | pinMode(9, OUTPUT); |
- | Next, the code does <fill in the blank>. | + | digitalWrite(9, |
- | <!-- Keep entering snippets of code and descriptions until you've given enough | + | digitalWrite(8, |
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // send data only when you receive data: | ||
+ | if (Serial.available() > 0) { | ||
+ | // read the incoming string: | ||
+ | input = Serial.readString(); | ||
+ | // read input data from the serial monitor | ||
+ | | ||
+ | // enter a command of 1 to turn on and off vac | ||
+ | if (command == 1) { | ||
+ | vac = !vac; | ||
+ | } | ||
+ | // enter a command | ||
+ | if (command == 3) { | ||
+ | blow = !blow; | ||
+ | } | ||
+ | /*Serial.print(" | ||
+ | | ||
+ | | ||
+ | | ||
+ | Serial.print(" | ||
+ | | ||
+ | |||
+ | if (vac && blow || !vac && !blow) { | ||
+ | vac = false; | ||
+ | blow = false; | ||
+ | Serial.println(" | ||
+ | // due to circuit design, a HIGH digital output corresponds | ||
+ | digitalWrite(9, | ||
+ | digitalWrite(8, | ||
+ | } | ||
+ | else if (blow) { | ||
+ | Serial.println(" | ||
+ | // digital pin 8 is connected to blow off | ||
+ | | ||
+ | digitalWrite(9, | ||
+ | delay(300); | ||
+ | digitalWrite(8, | ||
+ | blow = false; | ||
+ | vac = false; | ||
+ | Serial.println(" | ||
+ | } | ||
+ | else if (vac) { | ||
+ | Serial.println(" | ||
+ | // digital pin 9 is connected to vacuum | ||
+ | digitalWrite(9, | ||
+ | digitalWrite(8, | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </code> | ||
+ | The command for the ejector controller is entered through Serial Monitor on the Arduino IDE accessed through the Tools menu on the top of IDE. | ||
+ | Enter 1 in the command line to turn on vacuum. | ||
+ | {{ : | ||
+ | Enter 3 in the command line for a short blow off. | ||
+ | {{ : | ||
// | // | ||
// | // | ||
==== Final Words ==== | ==== Final Words ==== | ||
- | This tutorial' | + | This tutorial' |
- | \\ | + | |
- | \\ | + | |
- | Speculating future work derived from this tutorial, includes <fill in the blank>. In the big picture, the problem | + | |
\\ | \\ | ||
\\ | \\ | ||
- | For questions, clarifications, | + | For questions, clarifications, |
granular_gripper.txt · Last modified: 2019/07/29 16:22 by yuhanghe