final project update
Dependencies: mbed
Fork of DISCO_SMT32L4_pwm_PB3 by
main.cpp@6:57bad75ec95b, 2018-04-25 (annotated)
- Committer:
- adamzakaria
- Date:
- Wed Apr 25 00:21:14 2018 +0000
- Revision:
- 6:57bad75ec95b
- Parent:
- 5:620125c08317
- Child:
- 7:662af5825808
new code 4/24
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:4860a91fb495 | 1 | #include "mbed.h" |
carter7778 | 5:620125c08317 | 2 | Serial pc(SERIAL_TX, SERIAL_RX); |
adamzakaria | 6:57bad75ec95b | 3 | PwmOut mypwm(PWM_OUT); // PB3 - blue |
adamzakaria | 6:57bad75ec95b | 4 | PwmOut red_pwm(LED1); // PE8-red |
adamzakaria | 6:57bad75ec95b | 5 | PwmOut green_pwm(JOYSTICK_LEFT);// PA1 GREEN |
bcostm | 0:4860a91fb495 | 6 | |
bcostm | 0:4860a91fb495 | 7 | |
jblackann | 3:9aa9bfe031bb | 8 | #define UP 1 |
jblackann | 3:9aa9bfe031bb | 9 | #define DOWN 2 |
jblackann | 3:9aa9bfe031bb | 10 | |
carter7778 | 5:620125c08317 | 11 | void glow_blue(void){ |
carter7778 | 5:620125c08317 | 12 | int loop=1; |
carter7778 | 5:620125c08317 | 13 | uint8_t count_dir = UP; |
carter7778 | 5:620125c08317 | 14 | while(loop==1) |
carter7778 | 5:620125c08317 | 15 | { |
adamzakaria | 6:57bad75ec95b | 16 | printf("Enter d to exit loop\n\r"); |
carter7778 | 5:620125c08317 | 17 | char a = pc.getc(); |
carter7778 | 5:620125c08317 | 18 | for(int i=0; i<10; i++) |
carter7778 | 5:620125c08317 | 19 | { |
carter7778 | 5:620125c08317 | 20 | |
carter7778 | 5:620125c08317 | 21 | if(count_dir == UP) |
carter7778 | 5:620125c08317 | 22 | { |
carter7778 | 4:9d26d117fa69 | 23 | |
carter7778 | 5:620125c08317 | 24 | mypwm = mypwm + 0.1; |
carter7778 | 5:620125c08317 | 25 | if(mypwm == 1.00) |
carter7778 | 5:620125c08317 | 26 | { // if hit one, start counting down |
carter7778 | 5:620125c08317 | 27 | count_dir = DOWN; |
carter7778 | 5:620125c08317 | 28 | } |
carter7778 | 5:620125c08317 | 29 | } else if(count_dir == DOWN) |
jblackann | 3:9aa9bfe031bb | 30 | { |
carter7778 | 5:620125c08317 | 31 | mypwm = mypwm - 0.1; |
carter7778 | 5:620125c08317 | 32 | if(mypwm == 0.0) |
carter7778 | 5:620125c08317 | 33 | { // if hit zero, start counting up |
carter7778 | 5:620125c08317 | 34 | count_dir = UP; |
carter7778 | 5:620125c08317 | 35 | } |
carter7778 | 5:620125c08317 | 36 | } |
carter7778 | 5:620125c08317 | 37 | printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); |
carter7778 | 5:620125c08317 | 38 | } |
carter7778 | 5:620125c08317 | 39 | |
carter7778 | 5:620125c08317 | 40 | if(a =='d') { |
adamzakaria | 6:57bad75ec95b | 41 | printf("Exiting loop\n\r"); |
carter7778 | 5:620125c08317 | 42 | loop=0; |
carter7778 | 5:620125c08317 | 43 | } |
carter7778 | 5:620125c08317 | 44 | } |
carter7778 | 5:620125c08317 | 45 | } |
carter7778 | 5:620125c08317 | 46 | void glow_red(void){ |
carter7778 | 5:620125c08317 | 47 | int loop=1; |
carter7778 | 5:620125c08317 | 48 | uint8_t count_dir = UP; |
carter7778 | 5:620125c08317 | 49 | while(loop==1) |
carter7778 | 5:620125c08317 | 50 | { |
adamzakaria | 6:57bad75ec95b | 51 | printf("Enter d to exit loop\n\r"); |
carter7778 | 5:620125c08317 | 52 | char a = pc.getc(); |
carter7778 | 5:620125c08317 | 53 | for(int i=0; i<10; i++) |
carter7778 | 5:620125c08317 | 54 | { |
carter7778 | 5:620125c08317 | 55 | |
carter7778 | 5:620125c08317 | 56 | if(count_dir == UP) |
carter7778 | 5:620125c08317 | 57 | { |
carter7778 | 5:620125c08317 | 58 | |
adamzakaria | 6:57bad75ec95b | 59 | red_pwm = red_pwm + 0.1; |
adamzakaria | 6:57bad75ec95b | 60 | if(red_pwm == 1.00) |
carter7778 | 5:620125c08317 | 61 | { // if hit one, start counting down |
jblackann | 3:9aa9bfe031bb | 62 | count_dir = DOWN; |
jblackann | 3:9aa9bfe031bb | 63 | } |
carter7778 | 5:620125c08317 | 64 | } else if(count_dir == DOWN) |
carter7778 | 5:620125c08317 | 65 | { |
adamzakaria | 6:57bad75ec95b | 66 | red_pwm = red_pwm - 0.1; |
adamzakaria | 6:57bad75ec95b | 67 | if(red_pwm == 0.0) |
carter7778 | 5:620125c08317 | 68 | { // if hit zero, start counting up |
carter7778 | 5:620125c08317 | 69 | count_dir = UP; |
carter7778 | 5:620125c08317 | 70 | } |
jblackann | 3:9aa9bfe031bb | 71 | } |
adamzakaria | 6:57bad75ec95b | 72 | printf("pwm set to %.2f %%\n\r", red_pwm.read() * 100); |
carter7778 | 5:620125c08317 | 73 | } |
carter7778 | 5:620125c08317 | 74 | |
carter7778 | 5:620125c08317 | 75 | if(a =='d') { |
carter7778 | 5:620125c08317 | 76 | printf("Exiting loop"); |
carter7778 | 5:620125c08317 | 77 | loop=0; |
carter7778 | 5:620125c08317 | 78 | } |
carter7778 | 5:620125c08317 | 79 | } |
carter7778 | 5:620125c08317 | 80 | } |
carter7778 | 5:620125c08317 | 81 | void glow_green(void){ |
carter7778 | 5:620125c08317 | 82 | int loop=1; |
carter7778 | 5:620125c08317 | 83 | uint8_t count_dir = UP; |
carter7778 | 5:620125c08317 | 84 | while(loop==1) |
carter7778 | 5:620125c08317 | 85 | { |
adamzakaria | 6:57bad75ec95b | 86 | printf("Enter d to exit loop\n\r"); |
carter7778 | 5:620125c08317 | 87 | char a = pc.getc(); |
carter7778 | 5:620125c08317 | 88 | for(int i=0; i<10; i++) |
carter7778 | 5:620125c08317 | 89 | { |
carter7778 | 5:620125c08317 | 90 | |
carter7778 | 5:620125c08317 | 91 | if(count_dir == UP) |
carter7778 | 5:620125c08317 | 92 | { |
carter7778 | 5:620125c08317 | 93 | |
adamzakaria | 6:57bad75ec95b | 94 | green_pwm = green_pwm + 0.1; |
adamzakaria | 6:57bad75ec95b | 95 | if(green_pwm == 1.00) |
carter7778 | 5:620125c08317 | 96 | { // if hit one, start counting down |
carter7778 | 5:620125c08317 | 97 | count_dir = DOWN; |
carter7778 | 5:620125c08317 | 98 | } |
carter7778 | 5:620125c08317 | 99 | } else if(count_dir == DOWN) |
jblackann | 3:9aa9bfe031bb | 100 | { |
adamzakaria | 6:57bad75ec95b | 101 | green_pwm = green_pwm - 0.1; |
adamzakaria | 6:57bad75ec95b | 102 | if(green_pwm == 0.0) |
carter7778 | 5:620125c08317 | 103 | { // if hit zero, start counting up |
carter7778 | 5:620125c08317 | 104 | count_dir = UP; |
carter7778 | 5:620125c08317 | 105 | } |
carter7778 | 5:620125c08317 | 106 | } |
adamzakaria | 6:57bad75ec95b | 107 | printf("pwm set to %.2f %%\n\r", green_pwm.read() * 100); |
carter7778 | 5:620125c08317 | 108 | } |
carter7778 | 5:620125c08317 | 109 | |
carter7778 | 5:620125c08317 | 110 | if(a =='d') { |
adamzakaria | 6:57bad75ec95b | 111 | printf("Exiting loop\n\r"); |
carter7778 | 5:620125c08317 | 112 | loop=0; |
carter7778 | 5:620125c08317 | 113 | } |
carter7778 | 5:620125c08317 | 114 | } |
carter7778 | 5:620125c08317 | 115 | } |
carter7778 | 5:620125c08317 | 116 | void glow_purple(void){ |
carter7778 | 5:620125c08317 | 117 | int loop=1; |
carter7778 | 5:620125c08317 | 118 | uint8_t count_dir = UP; |
carter7778 | 5:620125c08317 | 119 | while(loop==1) |
carter7778 | 5:620125c08317 | 120 | { |
adamzakaria | 6:57bad75ec95b | 121 | printf("Enter d to exit loop\n\r"); |
carter7778 | 5:620125c08317 | 122 | char a = pc.getc(); |
carter7778 | 5:620125c08317 | 123 | for(int i=0; i<10; i++) |
carter7778 | 5:620125c08317 | 124 | { |
carter7778 | 5:620125c08317 | 125 | |
carter7778 | 5:620125c08317 | 126 | if(count_dir == UP) |
carter7778 | 5:620125c08317 | 127 | { |
adamzakaria | 6:57bad75ec95b | 128 | red_pwm = red_pwm + 0.1; |
carter7778 | 5:620125c08317 | 129 | mypwm = mypwm + 0.1; |
carter7778 | 5:620125c08317 | 130 | if(mypwm == 1.00) |
carter7778 | 5:620125c08317 | 131 | { // if hit one, start counting down |
carter7778 | 5:620125c08317 | 132 | count_dir = DOWN; |
carter7778 | 5:620125c08317 | 133 | } |
carter7778 | 5:620125c08317 | 134 | } else if(count_dir == DOWN) |
carter7778 | 5:620125c08317 | 135 | { |
adamzakaria | 6:57bad75ec95b | 136 | red_pwm = red_pwm - 0.1; |
carter7778 | 5:620125c08317 | 137 | mypwm = mypwm - 0.1; |
carter7778 | 5:620125c08317 | 138 | if(mypwm == 0.0) |
carter7778 | 5:620125c08317 | 139 | { // if hit zero, start counting up |
carter7778 | 5:620125c08317 | 140 | count_dir = UP; |
carter7778 | 5:620125c08317 | 141 | } |
carter7778 | 5:620125c08317 | 142 | } |
carter7778 | 5:620125c08317 | 143 | printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); |
adamzakaria | 6:57bad75ec95b | 144 | printf("2nd pwm set to %.2f %%\n\r", red_pwm.read() * 100); |
carter7778 | 5:620125c08317 | 145 | } |
carter7778 | 5:620125c08317 | 146 | |
carter7778 | 5:620125c08317 | 147 | if(a =='d') { |
carter7778 | 5:620125c08317 | 148 | printf("Exiting loop"); |
carter7778 | 5:620125c08317 | 149 | loop=0; |
carter7778 | 5:620125c08317 | 150 | } |
carter7778 | 5:620125c08317 | 151 | } |
carter7778 | 5:620125c08317 | 152 | } |
carter7778 | 5:620125c08317 | 153 | void glow_yellow(void){ |
carter7778 | 5:620125c08317 | 154 | int loop=1; |
carter7778 | 5:620125c08317 | 155 | uint8_t count_dir = UP; |
carter7778 | 5:620125c08317 | 156 | while(loop==1) |
carter7778 | 5:620125c08317 | 157 | { |
adamzakaria | 6:57bad75ec95b | 158 | printf("Enter d to exit loop\n\r"); |
carter7778 | 5:620125c08317 | 159 | char a = pc.getc(); |
carter7778 | 5:620125c08317 | 160 | for(int i=0; i<10; i++) |
carter7778 | 5:620125c08317 | 161 | { |
carter7778 | 5:620125c08317 | 162 | |
carter7778 | 5:620125c08317 | 163 | if(count_dir == UP) |
carter7778 | 5:620125c08317 | 164 | { |
adamzakaria | 6:57bad75ec95b | 165 | green_pwm = green_pwm + 0.1; |
carter7778 | 5:620125c08317 | 166 | mypwm = mypwm + 0.1; |
carter7778 | 5:620125c08317 | 167 | if(mypwm == 1.00) |
carter7778 | 5:620125c08317 | 168 | { // if hit one, start counting down |
carter7778 | 5:620125c08317 | 169 | count_dir = DOWN; |
carter7778 | 5:620125c08317 | 170 | } |
carter7778 | 5:620125c08317 | 171 | } else if(count_dir == DOWN) |
carter7778 | 5:620125c08317 | 172 | { |
adamzakaria | 6:57bad75ec95b | 173 | green_pwm = green_pwm - 0.1; |
carter7778 | 5:620125c08317 | 174 | mypwm = mypwm - 0.1; |
carter7778 | 5:620125c08317 | 175 | if(mypwm == 0.0) |
carter7778 | 5:620125c08317 | 176 | { // if hit zero, start counting up |
jblackann | 3:9aa9bfe031bb | 177 | count_dir = UP; |
jblackann | 3:9aa9bfe031bb | 178 | } |
jblackann | 3:9aa9bfe031bb | 179 | } |
carter7778 | 5:620125c08317 | 180 | printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); |
adamzakaria | 6:57bad75ec95b | 181 | printf("2nd pwm set to %.2f %%\n\r", green_pwm.read() * 100); |
carter7778 | 5:620125c08317 | 182 | } |
carter7778 | 5:620125c08317 | 183 | |
carter7778 | 5:620125c08317 | 184 | if(a =='d') { |
adamzakaria | 6:57bad75ec95b | 185 | printf("Exiting loop\n\r"); |
carter7778 | 5:620125c08317 | 186 | loop=0; |
carter7778 | 5:620125c08317 | 187 | } |
carter7778 | 5:620125c08317 | 188 | } |
carter7778 | 5:620125c08317 | 189 | } |
carter7778 | 5:620125c08317 | 190 | void glow_orange(void){ |
carter7778 | 5:620125c08317 | 191 | int loop=1; |
carter7778 | 5:620125c08317 | 192 | uint8_t count_dir = UP; |
carter7778 | 5:620125c08317 | 193 | while(loop==1) |
carter7778 | 5:620125c08317 | 194 | { |
adamzakaria | 6:57bad75ec95b | 195 | printf("Enter d to exit loop\n\r"); |
carter7778 | 5:620125c08317 | 196 | char a = pc.getc(); |
carter7778 | 5:620125c08317 | 197 | for(int i=0; i<10; i++) |
carter7778 | 5:620125c08317 | 198 | { |
carter7778 | 5:620125c08317 | 199 | |
carter7778 | 5:620125c08317 | 200 | if(count_dir == UP) |
carter7778 | 5:620125c08317 | 201 | { |
adamzakaria | 6:57bad75ec95b | 202 | red_pwm = red_pwm + 0.1; |
adamzakaria | 6:57bad75ec95b | 203 | green_pwm = green_pwm + 0.1; |
adamzakaria | 6:57bad75ec95b | 204 | if(red_pwm == 1.00) |
carter7778 | 5:620125c08317 | 205 | { // if hit one, start counting down |
carter7778 | 5:620125c08317 | 206 | count_dir = DOWN; |
carter7778 | 5:620125c08317 | 207 | } |
carter7778 | 5:620125c08317 | 208 | } else if(count_dir == DOWN) |
carter7778 | 5:620125c08317 | 209 | { |
adamzakaria | 6:57bad75ec95b | 210 | red_pwm = red_pwm - 0.1; |
adamzakaria | 6:57bad75ec95b | 211 | green_pwm = green_pwm - 0.1; |
carter7778 | 5:620125c08317 | 212 | if(mypwm == 0.0) |
carter7778 | 5:620125c08317 | 213 | { // if hit zero, start counting up |
carter7778 | 5:620125c08317 | 214 | count_dir = UP; |
carter7778 | 5:620125c08317 | 215 | } |
carter7778 | 5:620125c08317 | 216 | } |
adamzakaria | 6:57bad75ec95b | 217 | printf("pwm set to %.2f %%\n\r", green_pwm.read() * 100); |
adamzakaria | 6:57bad75ec95b | 218 | printf("2nd pwm set to %.2f %%\n\r", red_pwm.read() * 100); |
jblackann | 3:9aa9bfe031bb | 219 | } |
carter7778 | 5:620125c08317 | 220 | |
carter7778 | 5:620125c08317 | 221 | if(a =='d') { |
adamzakaria | 6:57bad75ec95b | 222 | printf("Exiting loop\n\r"); |
carter7778 | 5:620125c08317 | 223 | loop=0; |
carter7778 | 5:620125c08317 | 224 | } |
carter7778 | 5:620125c08317 | 225 | } |
carter7778 | 5:620125c08317 | 226 | } |
carter7778 | 5:620125c08317 | 227 | void glow_white(void){ |
carter7778 | 5:620125c08317 | 228 | int loop=1; |
carter7778 | 5:620125c08317 | 229 | uint8_t count_dir = UP; |
carter7778 | 5:620125c08317 | 230 | while(loop==1) |
carter7778 | 5:620125c08317 | 231 | { |
adamzakaria | 6:57bad75ec95b | 232 | printf("Enter d to exit loop\n\r"); |
carter7778 | 5:620125c08317 | 233 | char a = pc.getc(); |
carter7778 | 5:620125c08317 | 234 | for(int i=0; i<10; i++) |
carter7778 | 5:620125c08317 | 235 | { |
carter7778 | 5:620125c08317 | 236 | |
carter7778 | 5:620125c08317 | 237 | if(count_dir == UP) |
carter7778 | 5:620125c08317 | 238 | { |
adamzakaria | 6:57bad75ec95b | 239 | green_pwm = green_pwm + 0.1; |
adamzakaria | 6:57bad75ec95b | 240 | red_pwm = red_pwm + 0.1; |
carter7778 | 5:620125c08317 | 241 | mypwm = mypwm + 0.1; |
carter7778 | 5:620125c08317 | 242 | if(mypwm == 1.00) |
carter7778 | 5:620125c08317 | 243 | { // if hit one, start counting down |
carter7778 | 5:620125c08317 | 244 | count_dir = DOWN; |
carter7778 | 5:620125c08317 | 245 | } |
carter7778 | 5:620125c08317 | 246 | } else if(count_dir == DOWN) |
carter7778 | 5:620125c08317 | 247 | { |
adamzakaria | 6:57bad75ec95b | 248 | red_pwm = red_pwm - 0.1; |
carter7778 | 5:620125c08317 | 249 | mypwm = mypwm - 0.1; |
adamzakaria | 6:57bad75ec95b | 250 | green_pwm = green_pwm - 0.1; |
carter7778 | 5:620125c08317 | 251 | if(mypwm == 0.0) |
carter7778 | 5:620125c08317 | 252 | { // if hit zero, start counting up |
carter7778 | 5:620125c08317 | 253 | count_dir = UP; |
carter7778 | 5:620125c08317 | 254 | } |
carter7778 | 5:620125c08317 | 255 | } |
carter7778 | 5:620125c08317 | 256 | printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); |
adamzakaria | 6:57bad75ec95b | 257 | printf("2nd pwm set to %.2f %%\n\r", red_pwm.read() * 100); |
adamzakaria | 6:57bad75ec95b | 258 | printf("3rd pwm set to %.2f %%\n\r", green_pwm.read() * 100); |
carter7778 | 5:620125c08317 | 259 | } |
carter7778 | 5:620125c08317 | 260 | |
carter7778 | 5:620125c08317 | 261 | if(a =='d') { |
adamzakaria | 6:57bad75ec95b | 262 | printf("Exiting loop\n\r"); |
carter7778 | 5:620125c08317 | 263 | loop=0; |
carter7778 | 5:620125c08317 | 264 | } |
bcostm | 0:4860a91fb495 | 265 | } |
bcostm | 0:4860a91fb495 | 266 | } |
carter7778 | 5:620125c08317 | 267 | int main() { |
carter7778 | 5:620125c08317 | 268 | uint8_t loop=1; |
adamzakaria | 6:57bad75ec95b | 269 | uint8_t i; |
carter7778 | 5:620125c08317 | 270 | uint8_t count_dir; |
carter7778 | 5:620125c08317 | 271 | mypwm.period_ms(10); |
carter7778 | 5:620125c08317 | 272 | mypwm.pulsewidth_ms(1); |
adamzakaria | 6:57bad75ec95b | 273 | red_pwm.period_ms(10); |
adamzakaria | 6:57bad75ec95b | 274 | red_pwm.pulsewidth_ms(1); |
adamzakaria | 6:57bad75ec95b | 275 | green_pwm.period_ms(10); |
adamzakaria | 6:57bad75ec95b | 276 | green_pwm.pulsewidth_ms(1); |
adamzakaria | 6:57bad75ec95b | 277 | |
carter7778 | 5:620125c08317 | 278 | count_dir = UP; |
adamzakaria | 6:57bad75ec95b | 279 | pc.printf("Press '7' for White, Press '6' for Orange, Press '5' for Yellow, Press '4' for Green, Press '3' for Red, Press '2 for Purple, Press '1' for Blue, '0' to turn it OFF\n\r"); |
adamzakaria | 6:57bad75ec95b | 280 | while(loop== 1) { |
adamzakaria | 6:57bad75ec95b | 281 | /* |
carter7778 | 5:620125c08317 | 282 | mypwm=0; |
adamzakaria | 6:57bad75ec95b | 283 | red_pwm=0; |
adamzakaria | 6:57bad75ec95b | 284 | green_pwm=0; |
adamzakaria | 6:57bad75ec95b | 285 | */ |
carter7778 | 5:620125c08317 | 286 | char c = pc.getc(); // Read hyperterminal |
adamzakaria | 6:57bad75ec95b | 287 | |
carter7778 | 5:620125c08317 | 288 | if (c == 'o') { |
adamzakaria | 6:57bad75ec95b | 289 | mypwm=0; |
adamzakaria | 6:57bad75ec95b | 290 | red_pwm=0; |
adamzakaria | 6:57bad75ec95b | 291 | green_pwm=0; |
carter7778 | 5:620125c08317 | 292 | } |
adamzakaria | 6:57bad75ec95b | 293 | if (c == '1') { |
adamzakaria | 6:57bad75ec95b | 294 | |
adamzakaria | 6:57bad75ec95b | 295 | // ON |
adamzakaria | 6:57bad75ec95b | 296 | while(c=='1') { |
adamzakaria | 6:57bad75ec95b | 297 | glow_blue(); |
adamzakaria | 6:57bad75ec95b | 298 | c=0; |
carter7778 | 5:620125c08317 | 299 | } |
carter7778 | 5:620125c08317 | 300 | } |
carter7778 | 5:620125c08317 | 301 | |
adamzakaria | 6:57bad75ec95b | 302 | if (c == '2') { |
adamzakaria | 6:57bad75ec95b | 303 | |
adamzakaria | 6:57bad75ec95b | 304 | // ON |
adamzakaria | 6:57bad75ec95b | 305 | while(c=='2') { |
adamzakaria | 6:57bad75ec95b | 306 | glow_purple(); |
adamzakaria | 6:57bad75ec95b | 307 | c=0; |
adamzakaria | 6:57bad75ec95b | 308 | } |
adamzakaria | 6:57bad75ec95b | 309 | } |
adamzakaria | 6:57bad75ec95b | 310 | if (c == '3') { |
adamzakaria | 6:57bad75ec95b | 311 | |
adamzakaria | 6:57bad75ec95b | 312 | // ON |
adamzakaria | 6:57bad75ec95b | 313 | while(c=='3') { |
adamzakaria | 6:57bad75ec95b | 314 | glow_red(); |
adamzakaria | 6:57bad75ec95b | 315 | c=0; |
adamzakaria | 6:57bad75ec95b | 316 | } |
adamzakaria | 6:57bad75ec95b | 317 | } |
adamzakaria | 6:57bad75ec95b | 318 | if (c == '4') { |
adamzakaria | 6:57bad75ec95b | 319 | |
adamzakaria | 6:57bad75ec95b | 320 | // ON |
adamzakaria | 6:57bad75ec95b | 321 | while(c=='4') { |
adamzakaria | 6:57bad75ec95b | 322 | glow_green(); |
adamzakaria | 6:57bad75ec95b | 323 | c=0; |
adamzakaria | 6:57bad75ec95b | 324 | } |
adamzakaria | 6:57bad75ec95b | 325 | } |
adamzakaria | 6:57bad75ec95b | 326 | if (c == '5') { |
adamzakaria | 6:57bad75ec95b | 327 | |
adamzakaria | 6:57bad75ec95b | 328 | // ON |
adamzakaria | 6:57bad75ec95b | 329 | while(c=='5') { |
adamzakaria | 6:57bad75ec95b | 330 | glow_yellow(); |
adamzakaria | 6:57bad75ec95b | 331 | c=0; |
adamzakaria | 6:57bad75ec95b | 332 | } |
adamzakaria | 6:57bad75ec95b | 333 | } |
adamzakaria | 6:57bad75ec95b | 334 | if (c == '6') { |
adamzakaria | 6:57bad75ec95b | 335 | |
adamzakaria | 6:57bad75ec95b | 336 | // ON |
adamzakaria | 6:57bad75ec95b | 337 | while(c=='6') { |
adamzakaria | 6:57bad75ec95b | 338 | glow_orange(); |
adamzakaria | 6:57bad75ec95b | 339 | c=0; |
adamzakaria | 6:57bad75ec95b | 340 | } |
adamzakaria | 6:57bad75ec95b | 341 | } |
adamzakaria | 6:57bad75ec95b | 342 | if (c == '7') { |
adamzakaria | 6:57bad75ec95b | 343 | |
adamzakaria | 6:57bad75ec95b | 344 | // ON |
adamzakaria | 6:57bad75ec95b | 345 | while(c=='7') { |
adamzakaria | 6:57bad75ec95b | 346 | glow_white(); |
adamzakaria | 6:57bad75ec95b | 347 | c=0; |
adamzakaria | 6:57bad75ec95b | 348 | } |
adamzakaria | 6:57bad75ec95b | 349 | } |
adamzakaria | 6:57bad75ec95b | 350 | if( c== 'f') { |
adamzakaria | 6:57bad75ec95b | 351 | loop=0; |
adamzakaria | 6:57bad75ec95b | 352 | } |
adamzakaria | 6:57bad75ec95b | 353 | if (c == 'h'){ |
adamzakaria | 6:57bad75ec95b | 354 | pc.printf("Press '7' for White, Press '6' for Orange, Press '5' for Yellow, Press '4' for Green, Press '3' for Red, Press '2 for Purple, Press '1' for Blue, '0' to turn it OFF\n\r"); |
adamzakaria | 6:57bad75ec95b | 355 | } |
adamzakaria | 6:57bad75ec95b | 356 | |
carter7778 | 5:620125c08317 | 357 | } |
carter7778 | 5:620125c08317 | 358 | |
adamzakaria | 6:57bad75ec95b | 359 | } |
adamzakaria | 6:57bad75ec95b | 360 |