[IoT] Arduino with Delphi XE8 ~ LiquidCrystal and Temperature

Connection to Arduino devices from Delphi through a simple COM port serial.

> Function

  • LED On/Off Switch control
  • Read Temperature from sensor
  • Send Message to LiquidCrystal 

Full Soucre Download : Delphi Project and Arduino Code.



Delphi Application 



LiquidCrystal Circuit 



 Arduino Code 





Clipboard Sync App on Multi-Platform




I  developed and distributed the app to sharing the clipboard text between Multi-Platform devices (Phone, Tab, PC, Mac, etc.) by Tethering technology in Delphi XE8.

Install each OS app for your device in the same network class and touch the connect button for tethering.
You can connect multiple devices at the same time with a group by same Access Key.

You do not need to enter the IP Address, it will be automatically connected.

And you can immediately transfer text to the clipboard of the connected device by touch.

For example, created text on PC or Mac can be pasted in the edit box of Android or iOS phone.
You can also transfer the URL from the phone to Mac or another smartphone.
In case of URL,  the browser will be run immediately by one touch.
Of course, You can paste to the input box of browser.

[Notes]
If there are simultaneous users of this app within the same network class,

all devices of same Access Key will be connected.
In this case, Please enter the Access Key of your only.
Only devices with the same Access key will be connected.

You can download this app directly from the links below for Windows and Mac.
iOS and Android apps are available for download from Apple and Google app store.




Delphi XE8의 테더링 기술로 스마트폰, 탭, PC, Mac등 여러 디바이스들간에 클립보드 텍스트를 주고 받을수 있는 앱을 개발하여 배포 합니다.

같은 네트워크 클래스안에서 단말기 OS에 맞는 각각의 앱을 설치하고 연결버튼을 터치하면 각 디바이스들끼리 테더링 됩니다.
단말기 여러대를 동시에 연결 할 수도 있습니다.
이럴때는 동일한 Access Key를 사용하면 됩니다.
연결대상 단말기 IP Address를 입력하지 않아도 자동으로 연결 됩니다.

그리고 전송하려는 텍스트를 클립보드에 복사한 후 앱에서 터치하면 연결된 단말기의 클립보드에 바로 복사가 됩니다.

예를들면 PC나 맥에서 문장을 작성한 후 안드로이드나 iOS 폰으로 전송하여 문자 입력창에 붙여넣기를 할 수 있고,
폰에서 검색한 URL을 PC나 맥으로 전송 할 수도 있습니다.
URL의 경우에는 수신된 내용을 클릭하면 브라우져가 바로 실행이 되며
브라우져 주소창에 직접 붙여넣기도 물론 가능 합니다.

[주의사항]
같은 네트워크 클래스안에서 여러명이 동시에 이 앱을 사용하면,
Access Key가 같은 단말기는 모두 연결이 되므로 이때는 본인만의 Access Key를 입력하여 사용하기 바랍니다.
그러면 같은 Access Key를 가진 단말기들끼리만 연결이 됩니다.

Windows와 Mac용 어플리케이션은 아래 링크에서 직접 다운로드 받으면 되며,
안드로이드와 iOS앱은 구글 및 애플 앱스토어에서 다운로드가 가능합니다.



 
Download App for Windows

Download App for Mac OSX
If you see the message that "Can't be opened because it is from..."
Open by right/ctrl clicking on this file and click 'Open' only the first time.

Download App for Android

Download App for iOS








Running another app in Firemonkey android

Running another apps in Firemonkey android

Uses
  Androidapi.Helpers, AndroidApi.JNI.GraphicsContentViewText;

procedure TForm1.Button1Click(Sender: TObject);
var
 intent: JIntent;
begin
  intent := TJIntent.Create;
  intent := SharedActivityContext.getPackageManager.getLaunchIntentForPackage
              (StringToJString('com.kakao.talk')) ;
  if Assigned (intent) then
     SharedActivity.startActivity(intent);
end;

'com.kakao.talk' is a package name of another app.

Calculation of two point distance from location sensor

Calculation of two point distance from location sensor.

Unit of result value is a km.

function TForm1.CalcDistance( lon1, lat1,  lon2, lat2 : single ) : single;
var
   theta, dist : double;  

begin
   theta := lon1 - lon2;
   dist := sin( degTorad(lat1)) * sin(degTorad(lat2)) + cos(degTorad(lat1)) * cos(degTorad(lat2)) * cos(degTorad(theta));
   dist := arccos(dist);
   dist := radTodeg(dist);
   dist := dist * 60 * 1.1515;
   dist := dist * 1.609344;
   result := dist;
end;

Long Touch event generation method for Delphi XE5~XE7 Firemonkey On Android, iOS, OSX, And Windows

OnMouseClick event is used for Short Touch event in Button or ListBox, etc.
Delphi in FireMonkey do not provide a Long touch event separately.
Android or iOS smart device determines a long Touch time about 0.7 to 1.0 seconds normally .
Thus, Long Touch can be determined by measuring the count timer 0.1 seconds while pressing the button or any other objects.


Button이나 ListBox등에 사용되는 OnMouseClick 이벤트는 터치 단말기에서 숏터치에 사용 된다.
Delphi FireMonkey에서는 별도의 롱터치 이벤트를 제공하지 않는다.
따라서 롱터치 이벤트를 적용하기 위해서는 OnMouseDown 이벤트 싯점에 타이머를 가동하여 일정 시간이 흐른 후 롱터치로 판단하여 처리 할 수 있다.
안드로이드 또는 iOS 스마트 단말기는 보통 0.7~1.0 초 정도의 시간동안 사용자가 버튼을 누르고 있으면 롱터치로 판단한다.
따라서 버튼을 누르고 있는동안 0.1초 간격으로 타이머를 발생시켜 그 횟수를 측정하면 된다.


[Method]

1. OnMouseDown : Timer Start
2. OnMouseUp : Count Timer ~ Short Touch Event
3. OnTimer : Increase Timer Count ~ Long Touch Event

[Example source code]

1. Timer Initialize

  • Enable : False
  • Interval : 100 (msec)

2. Global variable declaration

var
  ClickInterval : Cardinal = 0;
const
   LONG_TIME = 8;  // Long Touch Time : 0.8 sec

3. Event Handlers work

procedure TForm1.ListBoxItem1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
   ClickInterval := 0;
   Timer1.Enabled := TRUE;
end;

//**********************************************************************************
// Short Touch
procedure TForm1.ListBoxItem1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
   if ClickInterval < LONG_TIME then
   begin
      Timer1.Enabled := FALSE;
      ClickInterval := 0;
      ShowMessage( 'ListBox Shot Touch..!!');
    end;
end;

//***************************************************************************************
// Long Touch
// Called once every 0.1 seconds ->  When the 8th call is a Long touch
procedure TForm1.Timer1Timer(Sender: TObject);
begin
   ClickInterval := ClickInterval + 1;

   if ( ClickInterval = LONG_TIME ) then
   begin
      Timer1.Enabled := FALSE;
      ShowMessage( 'ListBox Long Touch..!!');
   end;
end;

Full Source Download (Delphi XE7)