This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:c4eng:fall2023:projects:eapx [2023/11/14 13:58] – [premise] clamphi3 | notes:c4eng:fall2023:projects:eapx [2023/11/16 01:26] (current) – [part3] acuno | ||
---|---|---|---|
Line 18: | Line 18: | ||
{{: | {{: | ||
====part3==== | ====part3==== | ||
- | description | + | The stepper motor system works well. There are two buttons. When one of the buttons is pressed, the motor rotates clockwise. When the other button is pressed, the motor rotates counterclockwise. The amount that the motor rotates is set within the program. |
+ | {{: | ||
=====cgaffne1===== | =====cgaffne1===== | ||
====premise==== | ====premise==== | ||
Line 35: | Line 35: | ||
=====clamphi3===== | =====clamphi3===== | ||
====premise==== | ====premise==== | ||
- | I want to use joystick to change the color of the light. | + | I want to use joystick to change the color of a 4 legged |
====part1==== | ====part1==== | ||
- | How to read and change value | + | I used the following code to read the x,y & z values of the joystick as it moves. |
+ | |||
+ | < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include " | ||
+ | #include < | ||
+ | ///////////////////////////////////////////////////////////////////// | ||
+ | |||
+ | #define Z_Pin 1 //define pin for axis Z | ||
+ | ADCDevice *adc; // Define an ADC Device class object | ||
+ | |||
+ | ///////////////////////////////////////////////////////////////////// | ||
+ | |||
+ | int main(void){ | ||
+ | adc = new ADCDevice(); | ||
+ | printf(" | ||
+ | |||
+ | if(adc-> | ||
+ | delete adc; // Free previously pointed memory | ||
+ | adc = new PCF8591(); // If detected, create an instance of PCF8591. | ||
+ | } | ||
+ | |||
+ | else if(adc-> | ||
+ | | ||
+ | adc = new ADS7830(); // If detected, create an instance of ADS7830. | ||
+ | } | ||
+ | |||
+ | else{ | ||
+ | printf(" | ||
+ | " | ||
+ | " | ||
+ | |||
+ | | ||
+ | } | ||
+ | |||
+ | wiringPiSetup(); | ||
+ | pinMode(Z_Pin, | ||
+ | pullUpDnControl(Z_Pin, | ||
+ | while(1){ | ||
+ | int val_Z = digitalRead(Z_Pin); | ||
+ | int val_Y = adc-> | ||
+ | int val_X = adc-> | ||
+ | printf(" | ||
+ | delay(100); | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | </ | ||
====part2==== | ====part2==== | ||
- | description of changes made and construction pursuits, and some details | + | I set up the leds circuit |
+ | |||
+ | < | ||
+ | val_Z = digitalRead(Z_Pin); | ||
+ | |||
+ | if(val_Z == 0){ | ||
+ | softPwmWrite(HREPIN, | ||
+ | } | ||
+ | else{ | ||
+ | softPwmWrite(HREPIN, | ||
+ | } | ||
+ | ///////////////////////////////////////////////////////////// | ||
+ | val_Y = adc-> | ||
+ | |||
+ | softPwmWrite(TWOPIN , val_Y); | ||
+ | |||
+ | ///////////////////////////////////////////////////////////// | ||
+ | val_X = adc-> | ||
+ | |||
+ | softPwmWrite(ONEPIN , val_X); | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | https:// | ||
====part3==== | ====part3==== | ||
- | description | + | When moving the joystick around the light changes color and when any of the values hit their max one of the single led's will turn on. |
+ | |||
+ | < | ||
+ | val_Z = digitalRead(Z_Pin); //read digital value of axis Z | ||
+ | |||
+ | if(val_Z == 0){ | ||
+ | softPwmWrite(HREPIN, 100); | ||
+ | | ||
+ | } | ||
+ | else{ | ||
+ | softPwmWrite(HREPIN, | ||
+ | | ||
+ | } | ||
+ | ///////////////////////////////////////////////////////////// | ||
+ | val_Y = adc-> | ||
+ | |||
+ | softPwmWrite(TWOPIN , val_Y); | ||
+ | |||
+ | if (val_Y == 247){ | ||
+ | digitalWrite (REDLED, 1); | ||
+ | } | ||
+ | else{ | ||
+ | digitalWrite (REDLED, 0); | ||
+ | } | ||
+ | ///////////////////////////////////////////////////////////// | ||
+ | </ | ||
+ | https:// | ||
=====clovell3===== | =====clovell3===== | ||
====premise==== | ====premise==== | ||
Line 115: | Line 214: | ||
====part3==== | ====part3==== | ||
- | description of finished project details (not full source code), but present your finished product | + | For the finished product, I have a seven segment display that shows a hexadecimal counter that can be slowed down or sped back up to regular speed. Pressing the blue button slows the counter down the more you press it. Pressing the red button sets the speed at which it counts back to normal. These two buttons can be used to slow or speed up the counter in a way, without having to worry about a negative delay happening. |
+ | |||
+ | {{: | ||
=====lrogers3===== | =====lrogers3===== | ||
Line 238: | Line 339: | ||
====part3==== | ====part3==== | ||
- | description of finished project details (not full source code), but present your finished product | + | ===video=== |
+ | https:// | ||
+ | |||
+ | ===finished project details=== | ||
+ | |||
+ | As shown in the video above, all of the electronics are attached to a glider, with the main components | ||
+ | |||
+ | There are two servos on the tail, one for the elevator and the other for the rudder. The rudder (yaw) is the " | ||
+ | |||
+ | The servos on the ailerons both function using the " | ||
+ | |||
+ | The glider is set on a flat surface before receiving power. As soon as the microcontroller, | ||
+ | |||
+ | Once the glider is calibrated, it can be freely moved wherever it needs to be moved before launching. Each of the servos will attempt to maintain a neutral position of all control surfaces. This results in a glider that maintains stabilization and heads straight (no rudder/ | ||
+ | |||
+ | The factors used to maintain these angles are described extensively in part 2. | ||
+ | This was a really fun project that I was more than happy to take part in. There are so many features that I imagine for future iterations that were beyond the scope, like having the glider follow a GPS-based path for a true " | ||
=====nbutler5===== | =====nbutler5===== | ||
====premise==== | ====premise==== | ||
Line 264: | Line 381: | ||
====part3==== | ====part3==== | ||
- | description of finished | + | |
+ | eap2 is the finished | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
=====rford5===== | =====rford5===== | ||
Line 292: | Line 414: | ||
{{: | {{: | ||
====part3==== | ====part3==== | ||
- | description of finished project details (not full source code), but present your finished product | + | My finished product |
+ | {{: | ||
=====wjohns11===== | =====wjohns11===== | ||
====premise==== | ====premise==== |