Skip to content

Commit 5b99047

Browse files
authored
Merge pull request #40 from Joe7M/master
Add android file transfer
2 parents 267b2fe + 1e1e696 commit 5b99047

File tree

6 files changed

+258
-70
lines changed

6 files changed

+258
-70
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SmallBASIC File Transfer
2+
3+
Easy file transfer between your Android device and your desktop using WIFI.
4+
5+
## Step-by-Step Guide
6+
7+
1. Enable WIFI on your mobile to access your home network.
8+
2. In the [setup]-screen, select a font, enable extensions and give a port number, for example 5432.
9+
3. Follow the instructions to restart SmallBASIC.
10+
4. Open the [about]-screen to display the device IP and token.
11+
5. On your desktop browser, enter http://device-ip:port. For example: http://192.168.1.5:5432.
12+
6. You should see a login screen with "Enter your access token".
13+
7. Enter the token as shown in the [about]-page.
14+
8. You can now upload and download SmallBASIC files between your desktop and your mobile.
15+
16+
<div class="video-container">
17+
<iframe width="1158" height="651" src="https://www.youtube.com/embed/4Daj4YflyS0" title="SmallBASIC File Transfer" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
18+
</div>

_build/pages/articles.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [Setup external editors](/pages/language_support.html)
2222
- [Distribute your program](/pages/distributiontool.html)
2323
- [SmallBASIC web server](/pages/sbasicw.html)
24+
- [SmallBASIC file transfer](/pages/android_file_transfer.html)
2425

2526
## Plugins
2627

_build/pages/guide.markdown

+72-21
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Contents
4747
* [Maps as Pseudo Objects for OOP](#MapsAsPseudoObjectForOOP)
4848
* [Operators](#Operators)
4949
* [Pseudo-operators](#pseudo)
50+
* [Expressions](#Expressions)
5051
* [Subroutines and Functions](#SubroutinesAndFunctions)
5152
* [Names](#SubroutinesAndFunctionsNames)
5253
* [Declaration of Subroutines](#DeclarationOfSubroutines)
@@ -57,7 +58,7 @@ Contents
5758
* [Using Local Variables](#UsingLocalVariables)
5859
* [Nested Routines](#NestedRoutines)
5960
* [Declarations in PalmOS](#DeclarationsInPalmOS)
60-
* [Expressions](#Expressions)
61+
* [Conditions](#Conditions)
6162
* [IF-THEN-ELSIF-ELSE](#IfThenElseifEndif)
6263
* [Single-line IF-THEN-ELSE](#SingleLineIfThenElse)
6364
* [Inline Version of IF](#InlineVersionOfIf)
@@ -71,12 +72,15 @@ Contents
7172
* [Units](#Units)
7273
* [Declaration](#UnitsDeclaration)
7374
* [Import](#UnitsImport)
75+
* [Input and Output](#InputAndOutput)
76+
* [Print on Screen](#PrintOnScreen)
77+
* [Read Input from the Keyboard](#ReadInputFromKeyboard)
78+
* [The USE Keyword](#TheUseKeyword)
7479
* [OPTION](#Statement1)
7580
* [OPTION BASE](#Statement2)
7681
* [OPTION MATCH](#Statement3)
7782
* [OPTION PREDEF](#Statement4)
7883
* [Meta Commands](#Meta)
79-
* [The USE Keyword](#TheUseKeyword)
8084
* [Exception Handling](#ExceptionHandling)
8185

8286
:::
@@ -100,7 +104,7 @@ too.
100104

101105
### Windows {#Windows}
102106

103-
Download the [latest release of SmallBASIC](https://smallbasic.github.io/pages/download.html).
107+
Download the [latest release of SmallBASIC](/pages/download.html).
104108
The different versions of SmallBASIC are included in the zip-file. Extract the zip-file to a
105109
location of your choice. Open the SmallBASIC folder and start one of the following programs:
106110

@@ -110,7 +114,7 @@ location of your choice. Open the SmallBASIC folder and start one of the followi
110114

111115
### Linux {#Linux}
112116

113-
Download the [latest release of SmallBASIC](https://smallbasic.github.io/pages/download.html).
117+
Download the [latest release of SmallBASIC](pages/download.html).
114118
The different versions of SmallBASIC are provided as separate AppImages. Download an AppImage
115119
and copy it to a directory of your choice. Execute the AppImage. Depending of the Linux version
116120
you have to make the AppImage executable: `chmod u+x AppImageFile`, where `AppImageFile` is the
@@ -119,7 +123,10 @@ filename of the AppImage.
119123
### Android {#Android}
120124

121125
Download and install SmallBASIC for Android using
122-
[Google Play](https://play.google.com/store/apps/details?id=net.sourceforge.smallbasic).
126+
[Google Play](https://play.google.com/store/apps/details?id=net.sourceforge.smallbasic). Files
127+
are stored in `/InternalMemory/SmallBASIC` or in case of an old Android version in
128+
`/InternalMemory/Android/data/net.sourceforge.smallbasic/files`. For easy file transfer between
129+
Android and desktop, please read [SmallBASIC file transfer](/pages/android_file_transfer.html)
123130

124131
### Build from Source {#BuildFromSource}
125132

@@ -131,9 +138,9 @@ Please follow the instructions on [Github](https://github.com/smallbasic/SmallBA
131138

132139
Please read the separate articles for the different versions of SmallBASIC:
133140

134-
- [SDL](https://smallbasic.github.io/pages/sdl.html)
135-
- [Android](https://smallbasic.github.io/pages/android.html)
136-
- [FLTK](https://smallbasic.github.io/pages/fltk.html)
141+
- [SDL](/pages/sdl.html)
142+
- [Android](/pages/android.html)
143+
- [FLTK](/pages/fltk.html)
137144

138145
## Source Code Format {#SourceCodeFormat}
139146

@@ -1425,7 +1432,7 @@ the select-case structure will be exited and all following case statements will
14251432
tested anymore. If non of the case statements were entered the optional 'CASE ELSE'
14261433
statements will be entered.
14271434

1428-
See function reference [SELECT CASE](https://smallbasic.github.io/reference/655.html) for
1435+
See function reference [SELECT CASE](/reference/655.html) for
14291436
detailed information.
14301437

14311438
## Units {#Units}
@@ -1476,6 +1483,62 @@ IMPORT MyUnit as u
14761483
u.MyFunction(1)
14771484
```
14781485

1486+
## The USE Keyword {#TheUseKeyword}
1487+
1488+
The `USE` keyword is used on specific commands for passing a user-defined expression.
1489+
1490+
```smallbasic
1491+
SPLIT s," ",v USE TRIM(x)
1492+
```
1493+
1494+
In this example, every element of `v` will be trimmed. Use the `x` variable to
1495+
specify the parameter of the expression. If the expression needs more parameter,
1496+
you can use also the names `y` and `z`.
1497+
1498+
1499+
## Input and Output {#InputAndOutput}
1500+
1501+
### Print on Screen {#PrintOnScreen}
1502+
1503+
Use `PRINT` to print text on the screen at the current cursor location. When starting
1504+
the BASIC program, the cursor is in the top left corner. After printing to the screen
1505+
the cursor location will be updated. After execution of `PRINT`, if not otherwise
1506+
specified, the cursor will be moved to the beginning of the next line. When printing
1507+
to the last line of the screen, the screen will scroll up by one line.
1508+
1509+
Basic usage of `PRINT`:
1510+
1511+
```smallbasic
1512+
PRINT 1 ' Output: 1
1513+
PRINT 1+1 ' Output: 2
1514+
PRINT cos(pi) ' Output: -1
1515+
PRINT "Text" ' Output: Text
1516+
```
1517+
1518+
If `;` or `,` are used as last character of a print command, carriage return/line feed
1519+
(new line) will be suppressed after printing.
1520+
1521+
Please read the language reference of [PRINT](/reference/535.html)
1522+
for a detailed description. The text cursor can be set using
1523+
[LOCATE](/reference/530.html).
1524+
1525+
### Read Input from the Keyboard {#ReadInputFromKeyboard}
1526+
1527+
`INPUT` reads text from keyboard and stores it in a variable. `INPUT` can print a prompt
1528+
on screen. After execution of `INPUT` the cursor will be moved to the beginning of the
1529+
next line. `INPUT` will block execution of the program until the return-key is pressed.
1530+
1531+
Basic usage of `INPUT`:
1532+
1533+
```smallbasic
1534+
INPUT "How old are you?", age
1535+
PRINT age
1536+
```
1537+
1538+
For more information see language reference of [INPUT](/reference/527.html).
1539+
[INKEY](/reference/539.html) and [DEFINEKEY](/reference/1015.html) allow to read from
1540+
a keyboard without blocking the execution of the program.
1541+
14791542
## OPTION {#Statement1}
14801543

14811544
The `OPTION` command is used to pass parameters to the SB-environment. There are
@@ -1548,18 +1611,6 @@ SmallBASIC uses the following meta commands:
15481611
#unit-path: C:\sbasic\units;C:\temp
15491612
```
15501613

1551-
### The USE Keyword {#TheUseKeyword}
1552-
1553-
The `USE` keyword is used on specific commands for passing a user-defined expression.
1554-
1555-
```smallbasic
1556-
SPLIT s," ",v USE TRIM(x)
1557-
```
1558-
1559-
In this example, every element of `v` will be trimmed. Use the `x` variable to
1560-
specify the parameter of the expression. If the expression needs more parameter,
1561-
you can use also the names `y` and `z`.
1562-
15631614
## Exception Handling {#ExceptionHandling}
15641615

15651616
Exception handling is supported for file handling, and accessing serial ports and

pages/android_file_transfer.html

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<title>SmallBASIC | android_file_transfer</title>
8+
<meta name="description" content="SmallBASIC | One more basic">
9+
<link rel="canonical" href="/android_file_transfer.html">
10+
<link rel="keywords" href="android_file_transfer">
11+
<link rel="stylesheet" href="/css/style.css">
12+
<link rel="icon" type="image/png" href="/images/sb-desktop-32x32.png">
13+
<script src="/clipboard.js"></script>
14+
</head>
15+
<body>
16+
<button onclick="topFunction()" id="BackToTopBtn" title="Go to top">&#11205;</button>
17+
<script src="/backtotop.js"></script>
18+
<div class="wrapAll clearfix">
19+
<nav class="navigation">
20+
<div class="logo">
21+
<a href="/"><img src='/images/sb-logo.png?v=2' alt="logo"></a>
22+
</div>
23+
<div class="navlinks">
24+
<a href="/pages/download.html">Download</a>
25+
<a href="/pages/news.html">News</a>
26+
<a href="/pages/community.html">Community</a>
27+
<a class='active' href="/pages/articles.html">Resources</a>
28+
<a href="/pages/reference.html">Language Reference</a>
29+
<a href="/pages/guide.html">SmallBASIC Manual</a>
30+
</div>
31+
</nav>
32+
<div class="mainsection">
33+
<div class="tabs clearfix">
34+
<div class="tabsRight">
35+
<a target="_github" href="https://github.com/smallbasic/smallbasic.github.io/blob/master/_build/pages/android_file_transfer.markdown">Edit</a>
36+
<a target="_github" href="https://github.com/smallbasic/smallbasic.github.io/commits/master/_build/pages/android_file_transfer.markdown">History</a>
37+
</div>
38+
</div>
39+
<div class="article">
40+
<h1 id="smallbasic-file-transfer">SmallBASIC File Transfer</h1>
41+
<p>Easy file transfer between your Android device and your desktop using
42+
WIFI.</p>
43+
<h2 id="step-by-step-guide">Step-by-Step Guide</h2>
44+
<ol type="1">
45+
<li>Enable WIFI on your mobile to access your home network.</li>
46+
<li>In the [setup]-screen, select a font, enable extensions and give a
47+
port number, for example 5432.</li>
48+
<li>Follow the instructions to restart SmallBASIC.</li>
49+
<li>Open the [about]-screen to display the device IP and token.</li>
50+
<li>On your desktop browser, enter http://device-ip:port. For example:
51+
http://192.168.1.5:5432.</li>
52+
<li>You should see a login screen with “Enter your access token”.</li>
53+
<li>Enter the token as shown in the [about]-page.</li>
54+
<li>You can now upload and download SmallBASIC files between your
55+
desktop and your mobile.</li>
56+
</ol>
57+
<div class="video-container">
58+
<iframe width="1158" height="651" src="https://www.youtube.com/embed/4Daj4YflyS0" title="SmallBASIC File Transfer" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen>
59+
</iframe>
60+
</div>
61+
</div>
62+
<div class="pagefooter">
63+
This page was last edited on |
64+
<a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
65+
processed with
66+
<a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.1.12.1</a>
67+
</div>
68+
</div>
69+
</div>
70+
</body>
71+
</html>

pages/articles.html

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ <h2 id="getting-started">Getting started</h2>
6767
<li><a href="/pages/distributiontool.html">Distribute your
6868
program</a></li>
6969
<li><a href="/pages/sbasicw.html">SmallBASIC web server</a></li>
70+
<li><a href="/pages/android_file_transfer.html">SmallBASIC file
71+
transfer</a></li>
7072
</ul>
7173
<h2 id="plugins">Plugins</h2>
7274
<ul>

0 commit comments

Comments
 (0)