This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(void) { | |
unsigned long side; // room wall meters | |
unsigned long area; // size squared meters | |
UART_Init(); // call subroutine to initialize the uart | |
printf("This program calculates areas of square-shaped rooms\n"); | |
side = 1; | |
while(side < 50){ | |
area = Calc_Area(side); | |
printf("\nArea of the room with side of %ld m is %ld sqr m\n",side,area); | |
side = side+1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned long error; | |
// Tính diện tích căn phòng | |
// Input: kích thước căn phòng (unsigned long) | |
// Output: diện tích căn phòng (unsigned long) | |
// Notes: ... | |
unsigned long Calc_Area(unsigned long s) { | |
unsigned long result; | |
if(s <= 25){ | |
result = s*s; | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tính diện tích căn phòng hình vuông | |
// Input: Kích thước căn phòng (kiểu unsigned long) đơn vị mét | |
// Output: Diện tích căn phòng (kiểu unsigned long) đơn vị mét vuông | |
unsigned long Calc_Area(unsigned long s) { | |
unsigned long result; | |
result = s*s; | |
return(result); | |
} | |
int main(void) { | |
unsigned long side; // Kích thước căn phòng |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned long Calc_Area(unsigned long s); | |
int main(void) { | |
unsigned long side; // độ dài bức tường đơn vị met | |
unsigned long area; // diện tích căn phòng đơn vị met vuông | |
UART_Init(); // gọi subroutine để init uart | |
printf("This program calculates areas of square-shaped rooms\n"); | |
side = 3; | |
area = Calc_Area(side); | |
printf("\nArea of the room with side of %ld m is %ld sqr m\n",side,area); | |
side = side+2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(void){ | |
long x,y,z; // 3 biến x y z là local variables | |
x=1; y=2; // set giá trị của x và y | |
z = x+4*y; // tính z | |
x++; // Tăng x, cái này giống x=x+1; | |
y--; // Tương tự giảm y, giống y=y-1; | |
x = y<<2; // Dịch trái, tương tự x=4*y; | |
z = y>>2; // Dịch phải, tương tự x=y/4; | |
y += 2; // Tăng y, tương tự y=y+2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************* | |
Download latest Blynk library here: | |
https://github.com/blynkkk/blynk-library/releases/latest | |
Blynk is a platform with iOS and Android apps to control | |
Arduino, Raspberry Pi and the likes over the Internet. | |
You can easily build graphic interfaces for all your | |
projects by simply dragging and dropping widgets. | |
Downloads, docs, tutorials: http://www.blynk.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(void) { | |
unsigned long side; // Chieu dai cua can phong | |
unsigned long area; // Dien tich can phong | |
UART_Init(); // Gọi ham de init uart | |
side = 3; | |
area = side*side; | |
printf("\nDien tich cua can phong chieu dai %ld m la %ld m2\n",side,area); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//**** 0. Documentation Section | |
// This program calculates the area of square shaped rooms | |
// Author: Ramesh Yerraballi & Jon Valvano | |
// Date: 6/28/2013 | |
// | |
// 1. Pre-processor Directives Section | |
#include <stdio.h> // Diamond braces for sys lib: Standard I/O | |
#include "uart.h" // Quotes for user lib: UART lib | |
// 2. Global Declarations section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint32_t counter_1ms; | |
void Delay_ns(__IO uint32_t nCount) | |
{ | |
while(nCount--) | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <AmazonIOTClient.h> | |
#include "ESP8266AWSImplementations.h" | |
Esp8266HttpClient httpClient; | |
Esp8266DateTimeProvider dateTimeProvider; | |
AmazonIOTClient iotClient; | |
ActionError actionError; |