
rgb through potentiometer
main.cpp@0:b4c55dd82abb, 2020-02-10 (annotated)
- Committer:
- tweagle
- Date:
- Mon Feb 10 10:36:52 2020 +0000
- Revision:
- 0:b4c55dd82abb
rgb through analog potentiometers
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tweagle | 0:b4c55dd82abb | 1 | /* mbed Microcontroller Library |
tweagle | 0:b4c55dd82abb | 2 | * Copyright (c) 2019 ARM Limited |
tweagle | 0:b4c55dd82abb | 3 | * SPDX-License-Identifier: Apache-2.0 |
tweagle | 0:b4c55dd82abb | 4 | */ |
tweagle | 0:b4c55dd82abb | 5 | |
tweagle | 0:b4c55dd82abb | 6 | #include "mbed.h" |
tweagle | 0:b4c55dd82abb | 7 | #include "platform/mbed_thread.h" |
tweagle | 0:b4c55dd82abb | 8 | |
tweagle | 0:b4c55dd82abb | 9 | PwmOut r (D5); |
tweagle | 0:b4c55dd82abb | 10 | PwmOut g (D8); |
tweagle | 0:b4c55dd82abb | 11 | PwmOut b (D9); |
tweagle | 0:b4c55dd82abb | 12 | |
tweagle | 0:b4c55dd82abb | 13 | |
tweagle | 0:b4c55dd82abb | 14 | AnalogIn pot1 (A0); |
tweagle | 0:b4c55dd82abb | 15 | AnalogIn pot2 (A1); |
tweagle | 0:b4c55dd82abb | 16 | |
tweagle | 0:b4c55dd82abb | 17 | |
tweagle | 0:b4c55dd82abb | 18 | |
tweagle | 0:b4c55dd82abb | 19 | int main() |
tweagle | 0:b4c55dd82abb | 20 | { |
tweagle | 0:b4c55dd82abb | 21 | while (true) |
tweagle | 0:b4c55dd82abb | 22 | { |
tweagle | 0:b4c55dd82abb | 23 | r=pot1; |
tweagle | 0:b4c55dd82abb | 24 | g=pot2; |
tweagle | 0:b4c55dd82abb | 25 | b=pot1; |
tweagle | 0:b4c55dd82abb | 26 | } |
tweagle | 0:b4c55dd82abb | 27 | } |