Skip to content

Instantly share code, notes, and snippets.

View detik19's full-sized avatar

Tedy Tri Saputro detik19

View GitHub Profile
@detik19
detik19 / helloespshield.ino
Created January 28, 2016 23:05
Program Serial Sederhana
void setup() {
Serial.begin(9600);
}
void loop() {
delay(1000);
Serial.println("Halo ESP8266, Assalamualaikum :)");
}
data = load('ex1data1.txt');
X = data(:, 1); y = data(:, 2);
m = length(y);
figure;
plot(x, y, 'rx', 'MarkerSize', 10);
ylabel('Harga hunian');
xlabel('luas tanah');
X = [ones(m, 1), data(:,1)];
@detik19
detik19 / start.ino
Created April 14, 2016 00:30
Start Digispark
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(0, OUTPUT); //LED on Model B
pinMode(1, OUTPUT); //LED on Model A or Pro
}
// the loop routine runs over and over again forever:
void loop() {
@detik19
detik19 / main.c
Created April 24, 2016 02:12
Hello STM32
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"
GPIO_InitTypeDef GPIO_InitStructure;
void wait_ms(int t){
volatile int i;
for (i=0;i<t*2000;i++);
}
void setup_gpio(){
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
@detik19
detik19 / arduino_serv.ino
Created June 4, 2016 13:18
Arduino Server Serial Wifi
String a;
const int ledPin = 13; // the number of the LED pin
int ledState = LOW; // ledState used to set the LED
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
package net.ruangtedy.bey.client;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
public class SimpleClient {
package net.ruangtedy.java.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
@detik19
detik19 / buzzer.ino
Created October 22, 2016 04:59
Buzzer Multifunction
#include <TimerOne.h>
#include <Wire.h>
#include <MultiFuncShield.h>
void setup() {
// put your setup code here, to run once:
Timer1.initialize();
MFS.initialize(&Timer1); // initialize multi-function shield library
@detik19
detik19 / HelloESP01.ino
Created April 11, 2017 23:19
Hello World ESP-01 with Arduino
/*
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain
The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/
@detik19
detik19 / ESP-01-web.ino
Created April 14, 2017 06:31
Create ESP-01 to be Web Server
#include <ESP8266WiFi.h>
const char* ssid = "YOUR_SSID";//type your ssid
const char* password = "YOUR_PASSWORD";//type your password
int ledPin = 2; // GPIO2 of ESP8266
WiFiServer server(80);//Service Port
void setup() {
Serial.begin(115200);