PIR grove sensor that sends the sensed data to Thingspeak.com through the wifi module ESP 8266
Embed:
(wiki syntax)
Show/hide line numbers
Serial.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_SERIAL_H 00017 #define MBED_SERIAL_H 00018 00019 #include "platform/platform.h" 00020 00021 #if DEVICE_SERIAL 00022 00023 #include "Stream.h" 00024 #include "SerialBase.h" 00025 #include "PlatformMutex.h" 00026 #include "serial_api.h" 00027 00028 namespace mbed { 00029 /** \addtogroup drivers */ 00030 /** @{*/ 00031 00032 /** A serial port (UART) for communication with other serial devices 00033 * 00034 * Can be used for Full Duplex communication, or Simplex by specifying 00035 * one pin as NC (Not Connected) 00036 * 00037 * @Note Synchronization level: Thread safe 00038 * 00039 * Example: 00040 * @code 00041 * // Print "Hello World" to the PC 00042 * 00043 * #include "mbed.h" 00044 * 00045 * Serial pc(USBTX, USBRX); 00046 * 00047 * int main() { 00048 * pc.printf("Hello World\n"); 00049 * } 00050 * @endcode 00051 */ 00052 class Serial : public SerialBase, public Stream { 00053 00054 public: 00055 #if DEVICE_SERIAL_ASYNCH 00056 using SerialBase::read; 00057 using SerialBase::write; 00058 #endif 00059 00060 /** Create a Serial port, connected to the specified transmit and receive pins 00061 * 00062 * @param tx Transmit pin 00063 * @param rx Receive pin 00064 * @param name The name of the stream associated with this serial port (optional) 00065 * @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) 00066 * 00067 * @note 00068 * Either tx or rx may be specified as NC if unused 00069 */ 00070 Serial(PinName tx, PinName rx, const char *name=NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE); 00071 00072 00073 /** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud 00074 * 00075 * @param tx Transmit pin 00076 * @param rx Receive pin 00077 * @param baud The baud rate of the serial port 00078 * 00079 * @note 00080 * Either tx or rx may be specified as NC if unused 00081 */ 00082 Serial(PinName tx, PinName rx, int baud); 00083 00084 protected: 00085 virtual int _getc(); 00086 virtual int _putc(int c); 00087 virtual void lock(); 00088 virtual void unlock(); 00089 00090 PlatformMutex _mutex; 00091 }; 00092 00093 } // namespace mbed 00094 00095 #endif 00096 00097 #endif 00098 00099 /** @}*/
Generated on Tue Jul 12 2022 14:11:11 by 1.7.2