Temp36 HelloWorld Example for WIZwiki-W7500
Dependencies: mbed
Fork of AnalogIn_HelloWorld_WIZwiki-W7500 by
Diff: main.cpp
- Revision:
- 3:abab0082e271
- Parent:
- 2:5f564266c94f
- Child:
- 4:46410fc301ea
--- a/main.cpp Thu Jul 02 06:32:51 2015 +0000 +++ b/main.cpp Thu Jul 02 07:34:56 2015 +0000 @@ -1,40 +1,35 @@ -/* mbed Example Program - * Copyright (c) 2006-2014 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +/* Analog Input Example Program */ #include "mbed.h" // Initialize a pins to perform analog input and digital output fucntions -AnalogIn ain(A0); -DigitalOut dout(LED1); +AnalogIn ain(A0); +DigitalOut myled(LED1); // on-board LED_RED int main(void) { while (1) { // test the voltage on the initialized analog pin - // and if greater than 0.3 * VCC set the digital pin + // and if greater than 0.4 * VCC set the digital pin // to a logic 1 otherwise a logic 0 - if(ain > 0.5f) { - dout = 1; + if(ain > 0.4f) { + myled = 1; // Red LED Off } else { - dout = 0; + myled = 0; // Red LED On } - // print the percentage and 16 bit normalized values + // print the percentage and normalized values printf("percentage: %3.3f%%\r\n", ain.read()*100.0f); printf("analog value : %3.3f\r\n", ain.read()); wait(1.0); } } + + + + + + + + +