meshtastic/docs/development/js/connecting.mdx

25 lines
474 B
Plaintext
Raw Normal View History

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