Skip to content

Instantly share code, notes, and snippets.

View hocarm's full-sized avatar
🎃
Focusing

hocarm

🎃
Focusing
View GitHub Profile
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
Serial.println("\nI2C Scanner");
}
void loop() {
byte error, address;
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 6 23:27:32 2019
@author: jaordonez
"""
numeros = 1 + 2 * 3/ 4
#include "ThingSpeak.h"
#include <ESP8266WiFi.h>
//---------------- Fill in your credentails ---------------------
char ssid[] = "xxx"; // your network SSID (name), tên wifi
char pass[] = "xxxxx"; // your network password, password
unsigned long myChannelNumber = 1; // Replace the 0 with your channel number, channel của bạn
const char * myWriteAPIKey = "xxxxx"; // Paste your ThingSpeak Write API Key between the quotes, write API key
//------------------------------------------------------------------
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char* ssid = "wifi_name";
const char* password = "pass";
const char* mqttServer = "m12.cloudmqtt.com";
const int mqttPort = 10769;
const char* mqttUser = "your_username";
const char* mqttPassword = "your_password";
/**The MIT License (MIT)
Copyright (c) 2016 by Rene-Martin Tudyka
Based on the SSD1306 OLED library Copyright (c) 2015 by Daniel Eichhorn (http://blog.squix.ch),
available at https://github.com/squix78/esp8266-oled-ssd1306
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
#include "tm4c123ge6pm.h"
unsigned long In; // input from PF4
unsigned long Out; // output to PF2 (blue LED)
// Function Prototypes
void PortF_Init(void);
// 3. Subroutines Section
// 0.Documentation Section
// main.c
// Runs on LM4F120 or TM4C123
// C6_InputOutput, Input from PF4, output to PF2 (blue LED)
// Authors: Daniel Valvano, Jonathan Valvano and Ramesh Yerraballi
// Date: July 8, 2013
// LaunchPad built-in hardware
// SW1 left switch is negative logic PF4 on the Launchpad
// SW2 right switch is negative logic PF0 on the Launchpad
while(side != 0){
printf("Give room side(zero to quit):");
scanf("%ld", &side);
area = Calc_Area(side);
if(area != 0){
printf("\nArea with side of %ld m is %ld sqr m\n",side,area);
} else {
printf("\n Size cannot exceed 25 meters\n");
}
}
int main(void) {
unsigned long side; // Chiều dài của phòng đơn vị mét
unsigned long area; // Diện tích phòng đơn vị mét vuông
UART_Init(); // gọi subroutine để init uart
printf("This program calculates areas of square-shaped rooms\n");
for(side = 1; side < 50; side = side+1){
area = Calc_Area(side);
printf("\nArea of the room with side of %ld m is %ld sqr m\n",side,area);
}
}