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
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<!--body onload = "buttonClick()"--> | |
<body | |
<h1>Hello</h1> | |
<input id="myButton" type="button" value="click to discover bluetooth devices" onclick="buttonClick();"> | |
<p id="info"></p> | |
</body> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<h1>Local Storage Demo, 25.10.2017</h1> | |
<input type="text" id="key" placeholder="enter key" size = "10"> | |
<input type="text" id="value" placeholder="enter value" size = "30"> | |
<input type="button" value = "Save to localStorage" onclick = "saveToLocalStorage()"> |
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
/* | |
https://tttapa.github.io/ESP8266/Chap14%20-%20WebSocket.html | |
*/ | |
#include <ESP8266WiFi.h> | |
#include <WiFiClient.h> | |
#include <ESP8266WebServer.h> | |
#include <WebSocketsServer.h> | |
ESP8266WebServer server(80); |
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
<!doctype html> | |
<html> | |
<head> | |
<meta name="HandheldFriendly" content="true"/> | |
<title>ESP8266 WebSocket</title> | |
<style> | |
input, button, body { font: 13px Helvetica, Arial; } | |
#messages { font: 15px Helvetica, Arial; } | |
</style> | |
</head> |
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 <WiFiClient.h> | |
#include <WebSocketsServer.h> | |
WebSocketsServer webSocket = WebSocketsServer(81); | |
long previousWiFiToggleMillis = 0; | |
int wsConnected = 0; | |
uint8_t wsClient; | |
long previousMillis = 0; // will store last time potentimeter value was sent via websocket |
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 <ESP8266WebServer.h> | |
#include <ESP8266mDNS.h> | |
ESP8266WebServer server(80); | |
const char* ssid = "YOUR SSID"; | |
const char* password = "YOUR PASSWORD"; | |
void handleRoot() { |
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
package gsondemo; | |
import com.google.gson.Gson; | |
import java.util.Arrays; | |
/** | |
* GSON demo. Demonstrates effect of having no non-argument constructor on | |
* initialization of transient fields when creating an object from JSON string. | |
* Reference: https://stackoverflow.com/a/13532237/51358 | |
* @author skorkmaz, April 2018, License: Public Domain | |
*/ | |
public class GSONDemo { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets | |
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>BeginInvoke</Title> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
<SnippetType>SurroundsWith</SnippetType> | |
</SnippetTypes> |
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
//Day 22 of HackerRank 30 Days of Code challenge: Find height of binary search tree | |
class BSTHeight { | |
static int height = -1; | |
static int maxHeight = -1; | |
public static int getHeight(Node root){ | |
findMaxHeight(root); | |
return maxHeight; | |
} | |
private static void findMaxHeight(Node node) { |
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
//PWM of sine signal | |
const n = 12; | |
const maxAngle_rad = 3 * Math.PI; | |
const dAngle_rad = maxAngle_rad / n; | |
var sum = 0; | |
for (let i = 0; i < n; i++) { | |
const angle_rad = dAngle_rad * (i + 1); | |
const sinp1 = 1 + Math.sin(angle_rad); //normalized so that minimum value of sine signal is between [0, 2] | |
const dutyCyle = sinp1 / 2; //PWM duty cycle | |
//sum += sinp1 * 2 * Math.PI / n; |
OlderNewer