2021-04-01 17:34:44 -07:00
|
|
|
---
|
|
|
|
id: connecting
|
|
|
|
title: Connecting to a device
|
|
|
|
sidebar_label: Connecting
|
|
|
|
---
|
|
|
|
|
2022-03-08 23:10:41 -08:00
|
|
|
```tsx
|
2022-04-01 06:34:49 -07:00
|
|
|
import type React from 'React';
|
2021-04-01 17:34:44 -07:00
|
|
|
|
2022-04-01 06:34:49 -07:00
|
|
|
import { IHTTPConnection } from '@meshtastic/meshtasticjs';
|
2022-03-08 23:10:41 -08:00
|
|
|
|
|
|
|
export const Connection = (): JSX.Element => {
|
|
|
|
const connection = new IHTTPConnection();
|
|
|
|
|
|
|
|
const connect = (): void => {
|
|
|
|
void connection.connect({
|
2022-04-01 06:34:49 -07:00
|
|
|
address: '10.0.0.10',
|
2022-03-08 23:51:46 -08:00
|
|
|
fetchInterval: 3000,
|
2022-03-08 23:10:41 -08:00
|
|
|
});
|
2022-03-08 23:51:46 -08:00
|
|
|
};
|
2022-03-08 23:10:41 -08:00
|
|
|
|
|
|
|
return <button onClick={connect}>Connect Bluetooth</button>;
|
|
|
|
};
|
2021-04-01 17:34:44 -07:00
|
|
|
```
|