Skip to content

Instantly share code, notes, and snippets.

@shahrulnizam
shahrulnizam / Arduino LCD HD44780
Last active March 7, 2019 10:24
Arduino Lesson: LCD HD44780
/*
Project: LCD HD44780 Lesson
Programmer: Shahrulnizam Mat Rejab
Board: Arduino Uno
Last Modified: 7 March 2019
Website: http://shahrulnizam.com
*/
#include <LiquidCrystal.h>
@shahrulnizam
shahrulnizam / chipKIT Serial Communication
Last active December 17, 2015 01:39
ChipKIT Lesson: Serial Communication
/*
Project: Serial Communication Lesson
Programmer: Shahrulnizam Mat Rejab
Board: Chipkit UNO32/MAX32
Last Modified: 16 January 2014
Website: http://shahrulnizam.com
*/
int data;
@shahrulnizam
shahrulnizam / chipKIT UART
Last active December 17, 2015 01:39
ChipKIT Lesson: UART
int data;
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
Serial.println("Serial 0 Ready!");
Serial1.println("Serial 1 Ready!");
}
@shahrulnizam
shahrulnizam / chipKIT MAX7219
Last active December 17, 2015 01:39
ChipKIT Lesson: MAX7219
/*
Project: MAX7219 Lesson
Programmer: Shahrulnizam Mat Rejab
Last Modified: 30 November 2013
Website: http://shahrulnizam.com
*/
#include <LibraryChipSPI.h>
const char Font7x5[][5]={
@shahrulnizam
shahrulnizam / VB Message Box
Created May 11, 2013 23:57
VB Lesson: Message Box
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Visual Basic is fun", "shahrulnizam.com")
End Sub
End Class
@shahrulnizam
shahrulnizam / VB Text Box
Created May 12, 2013 00:01
VB Lesson: Text Box & Label
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = TextBox1.Text
End Sub
End Class
@shahrulnizam
shahrulnizam / VB If Statement
Created May 12, 2013 00:29
VB Lesson: If Statement
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "1? Then" Then
Label1.Text = "is one"
End If
If TextBox1.Text = "2? Then" Then
Label1.Text = "is two"
End If
If TextBox1.Text = "3? Then" Then
Label1.Text = "is three"
@shahrulnizam
shahrulnizam / VB Variable
Created May 12, 2013 01:17
VB Lesson: Variable
Public Class Form1
Dim message As String = "Value"
Dim number As Integer = 123
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = message
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label1.Text = number
End Sub
End Class
@shahrulnizam
shahrulnizam / VB Function
Created May 12, 2013 01:21
VB Lesson: Function
Public Class Form1
Dim num1 As Integer
Dim num2 As Integer
Private Function copy()
num1 = TextBox1.Text
num2 = TextBox2.Text
End Function
Private Function add(ByVal a As Integer, ByVal b As Integer)
Return num1 + num2
End Function
@shahrulnizam
shahrulnizam / VB HScrollBar & VScrollBar
Created May 12, 2013 02:42
VB Lesson: HScrollBar & VScrollBar
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
HScrollBar1.Minimum = 20
HScrollBar1.Maximum = 200
VScrollBar1.Minimum = 20
VScrollBar1.Maximum = 200
Label1.Text = "(" & VScrollBar1.Value & "," & HScrollBar1.Value & ")"
Label1.Location = New Point(HScrollBar1.Value, VScrollBar1.Value)
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll