Quantcast
Channel: Small Basic
Viewing all 201 articles
Browse latest View live

Small Basic Marionette - Sign up for the Big Challenge for September 2014!!!

$
0
0

This thread is for recruiting contributors to a new group challenge that's coming from the Monthly Challenges, for September 2014.

 

Group Challenge

  1. Apply in this thread to create a group (with two or more people) until Aug. 31.
  2. During the month of September, you'll create a marionette (or puppet) per group which can be moved by user interaction until Sep. 30.

Picture of a marionette

 

Here are parts you can sign up for this project:

  • to design a marionette (or puppet) graphics
  • to design user interface
  • to code motion dynamics engine
  • to be a coder
  • to write prototype program

 

Please sign up for the September Big Challenge in this thread.

 

Thanks to Nonki Takahashi for hosting this contest!

   - Ninja Ed


Small Basic - Physics for Marionette Challenge

$
0
0

A 'Big ' Challenge for groups of programmers has been created by Nonki.  We are recruiting during August for development in September.

Picture of a marionette

In summary the challenge is to create a marionette puppet in Small Basic, here is an extract of the challenge:

"create a marionette (or puppet) per group which can be moved by user interaction"

If you fancy working on this in a group effort, whatever your programming level, then add a post to the Small Basic Big Challenge Thread.  Working in a group can make learning programming more fun.

This blog outlines some ideas for the physics part of the challenge which could be a bit tricky, other aspects of the challenge not addressed here include:

  • marionette (or puppet) graphics
  • user interface design
  • user control

Physical Principals

Basically, a marionette will consist of limbs connected together.  We can say that each limb will have a certain length (L) and perhaps a mass (M).  The limbs could all have equal mass or have a mass dependent on the limb size in some way.

The limbs are connected at joints (or nodes), so each node has one or more limbs connected to it. 

The simplest analogy is to think of the limbs as connected springs to help calculate their movements.

Here are some physical principals.

  • When the marionette is stationary, the force on each node is zero in all directions.
  • The limbs connected to a node exert a force down (+Y) proportional to the limb mass.
  • If the limbs are stretched beyond their natural length then they are in tension and exert a force proportion to the extension in a direction to contract the limb.
  • If the limbs are compressed below their natural length then they are in compression and may exert a force proportional to the compression in a direction to extend the limb.
  • Strings connected to limbs only act in tension (strings cannot push something, they only pull).

Node Forces

Here is a schematic picture of a node at (X,Y) connected to 3 limbs.

The natural length of the limbs are shown in blue (L1, L2 and L3)

Limbs 1 and 2 are stretched beyond this length by E1 and E2, while limb 3 is compressed by distance C3.

  • The force exerted on the central node by limb1 is proportional to E1/L1 in a direction away from the node.
  • The force exerted on the central node by limb2 is proportional to E2/L2 in a direction away from the node.
  • The force exerted on the central node by limb3 is proportional to C3/L3 in a direction towards the node.  This compressive force term is not used for strings, and may optionally also be omitted for limbs.

Each force vector can be resolved into X and Y components, and added separately with a contribution to each node from its connected limbs.

  • Assume the node is at (X,Y) and the far end of limb1 is at  (X1,Y1), the a vector in the direction of the limb away from the node is (X1-X,Y1-Y), so the force vector for this limb on the node is proportional to (X1-X,Y1-Y)  * E1 / L1.  Note that the length of the vector (X1-X,Y1-Y) is L1+E1, the length of the stretched or extended limb (Lext).
  • Additionally, there is a gravity force down (positive Y direction) on the node proportional to the mass of the connected limbs.
  • The gravity and limb stretching forces will need to be suitably scaled to provide smooth movement.  Scaling will just be fixed numbers that multiply the forces or gravity terms.

Where a and b are scaling factors and Lext is the extended (or compressed) length of a limb.  If compression is not used, then only terms where Lext > L are included.

Animation Scheme

The exact physics isn't that critical, just the basic principals. 

  • If the limbs are too 'stiff' with large forces (large scaling factor a) the scheme may oscillate or be unstable, if the limbs are too 'springy' they may stretch unrealistically far - its a balance to what 'looks good'.
  • If the gravity forces are too large (large scaling factor b) then the limbs may be stretched too far, if the gravity forces are too weak then the marionette will tend to float about and not fall realistically as it is moved.

The net force vectors (Fx,Fy) for each node are calculated, then used to move the nodes towards stationary (zero net force) positions.  We can move the nodes by an amount proportional to the net forces and their directions, then recalculate everything with the updated node positions.

, where c is another scaling factor.

In some cases, stability may be improved by averaging (Fx,Fy) from one step to the next to reduce oscillation about a zero force solution.

If the scheme forces are well scaled, then after a few steps the marionette nodes will be balanced with zero net force, until we move the strings.  The top of the strings are fixed positions and are moved only by the user in some way.

Join the Big Challenge project - Small Basic Marionette

$
0
0

From today, the new Big Challenge started in Small Basic forum.  Why don't you join this challenge?

 

This thread is for a new group challenge dropped out from the Monthly Challenges.

This challenge is intended for people who are learning to program together within a group using Small Basic.

Please post your application / suggestions / questions / feedback etc. into this thread that will remain ‘sticky’ for the month.

Also post feedback on the kind of challenges that you want to see more of in the future.

Group Challenge

  1. Apply in this thread to create a group (with two or more people).
  2. Then create a marionette (or puppet) per group which can be moved by user interaction.

Picture of a marionette

Current Contributors

  • Ed Price - the marionette graphics or UI
  • litdev - to write a prototype of a motion dynamics engine
  • Jibba Jabba - suggested like / don't like counter
  • Nonki Takahashi - to make bitmaps from your design (picture)

Vector Sample in Small Basic

Small Basic Guru Awards: January 2016 Winners

$
0
0

We had a light competition in January, but Nonki beat me fair and square:

Guru Award  Small Basic Technical Guru – January 2016  

Gold Award Winner

 

Nonki Takahashi Small Basic: Clock Michiel Van Hoorn: “Great article on the clock object and how to work with time. Foundational knowledge for any programmer.”
Peter Laker: “Nicely formed, well laid out, good contribution”

Silver Award Winner

 

Ed Price – MSFT Small Basic: Prime Sieve Michiel Van Hoorn: “Fun math example were an mathematical challenge is solved in Small Basic. Great to learn the beauty of math and programming”
Peter Laker: “Professionally written, great addition”

   

Special thanks to Nonki and our judges for a great round of Small Basic Guru!

For information about the February competition, see You could be our Fabulous February Small Basic Guru! 

If you’d like to see the January winners for the other Microsoft technologies/categories, head to The TechNet Guru Awards, January 2016!

 

Have a Small and Basic day!

   – Ninja Ed

 

Small Basic Featured Article – How to Publish Your Program

$
0
0

Ever need to share your Small Basic program? Are you a teacher who needs this basic information as a resource? Then you’ve come to the right place!

Read the full article here:

Small Basic: How to Publish Your Program

  

Here is the TOC:

Table of Contents

 

  

And here is an excerpt from the article:

Sharing Your Program

You can easily share your program with your friends or the Small Basic community! Just click Publish on the Toolbar. (You will need to be connected to the internet.)

After clicking Publish a dialogue box will appear that has a Program ID for your program. 

   

 

Please head here to read the full article:

Small Basic: How to Publish Your Program

   

Small and Basically yours,

   – Ninja Ed

Cartesian and Polar Coordinates in Small Basic

$
0
0

I introduced a Small Basic sample code about 2-dimensional vector in my last blog.  A 2-D vector has two elements.  A point in the plane has x coordinate and y coordinate.  This kind of coordinate is called Cartesian coordinates.

Today, I’d like to introduce another coordinate system – polar coordinates.  In polar coordinates, a point is represented with r (the length from the origin) and θ (the angle between the vector and the x axis).  A sample program TJB764 shows both coordinates.

 

Conversion from polar coordinates to Cartesian coordinates

This is easy.

Small Basic code is as follows.  A variable a means θ above.

x = r * Math.Cos(a)
y = r * Math.Sin(a)

Conversion from Cartesian coordinates to polar coodinates

This is basically easy.

Small Basic code is:

Sub Math_CartesianToPolar
  ' Math | convert Cartesian coodinate to polar coordinate
  ' param x, y - Cartesian coordinate
  ' return r, a - polar coordinate (0<=a<360)
  r = Math.SquareRoot(x * x + y * y)
  If x = 0 And y > 0 Then
    a = 90 ' [degree]
  ElseIf x = 0 And y < 0 Then
    a = -90
  ElseIf x = 0 Then ' this condition is needed for SB 1.2
    a = 0
  Else
    a = Math.ArcTan(y / x) * 180 / Math.Pi
  EndIf
  If x < 0 Then
    a = a + 180
  ElseIf x > 0 And y < 0 Then
    a = a + 360
  EndIf
EndSub

I already wrote about this subroutine in this blog titled Small Basic Game Programming – Game Math.  But the last one causes divide by zero error in Small Basic 1.2.

Math function tan-1 is Math.ArcTan() operation in Small Basic.  The graph of this operation is:

Small Basic Monthly Challenges – March 2016

$
0
0

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard – but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain ‘sticky’ for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

We may extend these challenges over into a second month if solutions and questions are still coming in.

Also post feedback on the kind of challenges that you want to see more of in the future.

Text Challenges

  • Write a program to count the number of vowels in a sentense.
  • Write a program to translate a sentence between some of the languages supported by the Dictionary object.
  • Write a program to write out the times tables to the TextWindow.  Use colour and positionng to tabulate the numbers to make the display clear and easy to read.

 

Graphics Challenges

  • Write a program to flash an object when the mouse passes over it.
  • Extend the program to have several randomly positioned shapes.
  • Write a program to move objects with some depth perspective – objects further away appear to move more slowly, they may also be fainter and be positioned behind foreground objects to help the effect.
  • Modify the program to move some stationary (or even moving) objects at different distances when the user’s view changes.
  • Write a program with subroutines to move Triangle and Line shapes.  The subroutines should be able to move the shapes so their center is at defined coodinates.
  • Write a program to rotate and move a Line shape so that it rotates like a second hand on a watch.
  • Write a program to write a musical phrase for use with the Music object to standard notation on a stave.

 

Maths Challenges

  • Write a program to solve quadratic equations.
  • Write a program to calculate all the internal angles of a triangle from the coordinates of the corners.

 

Game Challenges

  • Write a simple FPS (first person shooter) game.  When you move in an FPS, it is the player’s view that moves – this is the same as moving the objects in the view in the opposite direction.
  • Write a solliair marbles game.

 

Do you have an idea for a future challenge? Please post it on the forum here!

 

Have a Small and Basic month!

   – LitDev & Ninja Ed

 

 


Physics in Small Basic

$
0
0

What is Physics

According to SmallBasic.Dictionary, physics is “study of physical forces and qualities”.

Velocity Model

I once wrote about velocity in a blog post Small Basic Game Programming – Game Math.  This is the basic of physical simulation.  A program JLF545-1 illustrates the relation between time and velocity.

A program KXQ212-2 is a simple sample of physical simulation.  You can accelerate the moon lander with up arrow key.

Inverted Pendulum

Writing physical simulation program is not so easy.  But there are some physics engines that supports physical simulations.  Box2D is one of them and LitDev Extension contains LDPhysics object that wraps Box2D physics engine.  I wrote a sample ZFJ443 which simulates inverted pendulum.  You can move the inverted pendulum with left and right arrow keys. 

See Also

These are links to Small Basic blog posts about physics.

Small Basic – Chord Sounds

$
0
0

This blog is by Small Basic user Yvan Leduc and is based on this Forum Post.  It shows how to play musical chords in Small Basic just using the standard Sound.PlayMusic method.

Objective

How to play a complete music chord, for example a C major chord, instead of playing the separate notes.

Solution

A full sample program is provided with the publish code, NNP250.  It plays the first staves of a piece for classical guitar written by Matteo Carcassi: Study No.6 Op60.

How it Works

As an example of a chord in the program, we look at a C major chord which plays 3 notes together.

Here is a full C major:

a[1]="o4l64 E" +"o6l64 C" +"o8l64 G" 'C major chords, 3 notes together
n[1]="o5l6 E"

It has two variables a and n, together they build the chord,

o4 = the octave on the keyboard

l64 = the duration of the note (very short)

E = the note

E+C+G = C major on a piano.

and the final instruction that plays the chord is:

Sound.PlayMusic (a[t]+n[t])

This is placed in a For Endfor loop with other chords and notes.

Thanks Yvan for sharing this.

Small Basic – TextWindow Colors

$
0
0

In Small Basic, you can change the background and foreground colors of the text window’s output text using the BackgroundColor and ForegroundColor properties of TextWindow.

You specify the desired color by number or by name. The permissible values are shown here:

Figure: The available TextWindow colors

For example, to output your text in yellow, you can use the word “Yellow” or the number 14:

TextWindow.ForegroundColor = “Yellow”  ‘ Uses color name

TextWindow.ForegroundColor = 14             ‘ Uses color number

  

Have a Small and Basic week!

   – Ninja Ed & Majed Marji  

   

See Also

 

 

Small Basic Featured Thread – Suggestion for a challenge: Calculations by Hand

$
0
0

This is not so new thread but I love this one: Suggestion for a challenge by jherch77 in Small Basic forum.


I would like to make the following suggestion for a challenge:

Create a fully functional calculator (8-digit, basic calculator, not scientific) but do all the calculations by hand…meaning that if the user wants 356 * 8…the program should multiply 8*6 then 8*5+4 then 8*3+4. Just like you would do it if you had to multiply with pencil and paper. This would require addition, subtraction, multiplication and division and as an added challenge, negative numbers.


I wrote the first beta program for division by writing: PHW347.

This program can calculate correctly only special cases.  I’m going to rewrite this program to more generic cases.

Thank you jherch77 for your challenge!

Calling all Small Basic Gurus!! It’s time to MARCH into the history books!

$
0
0

It’s another month, and another chance to find… the one!

That special person who brings us… the knowledge!

That thing we didn’t know.

That revelation that saves us so much bandwidth on the search tool.

Clear and concise revelations that bring us closer to our goal!

You have that power my friends!

Step forth with words of wisdom!

Step up and let us know your name!

Carve your mark on the community… and history!

MARCH forth and win glory, fame, love honour and immortality!!!! (in the form of the written word… kind of…)

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day’s work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations to TechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you’ve contributed)  <—-

3) Every month, we will highlight your contributions, and select a “Guru of the Month” in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once “on our radar” and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

Below are last month’s mighty winners and contenders!

Thanks in advance!

Ninja Ed &…
Pete Laker

Units of Measurement in Small Basic

$
0
0

What is a Unit?

A unit is a standard measurement whose multiples are used in determining quantity, e.g. an inch, degree, calorie, volt, or hour. (Dictionary object)

Units in Small Basic

There are some different units used in Small Basic objects:

  • Pixel – graphics dot unit
  • Column – text horizontal character unit
  • Row – text vertical character unit
  • Year – 365 or 366 days
  • Month – 28~31 days
  • Day – 24 hours
  • Hour – 60 minutes
  • Minute – 60 seconds
  • Second – 1000 milliseconds
  • Millisecond – 1/1000 of a second
  • Degree – angle unit (360 degree = 1 round)
  • Radian – angle unit (2π radian = 1 round)

And the following units don’t have their names of units:

  • Turtle Speed – 1~10
  • Opacity – 0~100
  • Color Value – 0~255

See Also

Small Basic – Arduino

$
0
0

Arduino is a cheap and popular way to build your own electronics, typically with small sensors and motors, and learn a bit of programming to control it.

Controlling it with Small Basic enables you to display data it generates or change settings interactively from your PC.

Serial Communication

This blog is not about Arduino features, but how to communicate with it with Small Basic using a serial port extension, in this case LDCommPort in the LitDev extension  (see LDCommPort API).  Basically, we can send and receive data as bytes or strings to the Arduino via its USB connection.  I used strings since we can always cast these to anything else like numbers in Arduino and Small Basic.

You could use any convention for your data, but you will need an event (LDCommPort.DataReceived) in Small Basic to detect that data has been received.  No event is required in the Arduino program, since it operates in a continual loop, you just check for new data each time the loop runs.

Send Data to Arduino from Small Basic

When sending data to the Arduino, I used the first character to define the data type:

  • i for an integer
  • f for a float
  • s for a string
  • 1-8 for one of 8 buttons I created in the Small Basic interface

Send Data to Small Basic from Arduino

When sending data from the Arduino to Small Basic, I just sent whatever data I wanted as an ascii string, testing integers, floats, strings and characters.  I used a line-feed character ‘\n’ (ascii code 10) to terminate all data for transfer.  This is automatically added by the Arduino command Serial.println, but not by Serial.print.

Arduino Settings

The following are the Arduino settings I used for an Arduino UNO, note it uses COM3 (yours may be different) port and ArduinoISP programmer.

Small Basic Interface

This is the Small Basic interface, import VBZ059.

The Small Basic code for this interface is a bit longer than it could be, most of it is just creating the interface and button events.

Initialise()
‘==================================================
‘MAIN LOOP
‘==================================================
While (“True”)
  If (newData <> “”) Then
    tbData = Text.Append(“Data received : “+newData+nl,Controls.GetTextBoxText(tb))
    Controls.SetTextBoxText(tb,tbData)
    newData = “”
  EndIf
  Program.Delay(10)
EndWhile
‘==================================================
‘SUBROUTINES
‘==================================================
Sub Initialise
  gw = 600
  gh = 215
  GraphicsWindow.Width = gw
  GraphicsWindow.Height = gh
  GraphicsWindow.Title = “Small Basic Arduino Interface”
  GraphicsWindow.BackgroundColor = “Gray”
  GraphicsWindow.BrushColor = “Black”
  nl = Text.GetCharacter(10)
  ‘
  status = LDCommPort.OpenPort(“COM3″,9600)
  LDCommPort.SetEncoding(“Ascii”)
  LDCommPort.DataReceived = OnDataReceived
  ‘
  nButton = 8
  spacing = (gw-30)/nButton
  width = (gw-40)/nButton-10
  For i = 1 To nButton
    buttons[i] = Controls.AddButton(“Action”+i,20+spacing*(i-1),175)
    Controls.SetSize(buttons[i],width,25)
    LDShapes.BrushColour(buttons[i],“SteelBlue”)
  EndFor
  Controls.ButtonClicked = OnButtonClicked
  ‘
  clear = Controls.AddButton(“Clear”,20,20)
  Controls.SetSize(clear,width,25)
  LDShapes.BrushColour(clear,“SteelBlue”)
  ‘
  send = Controls.AddButton(“Send”,20+spacing,20)
  Controls.SetSize(send,width,25)
  LDShapes.BrushColour(send,“SteelBlue”)
  ‘
  value = Controls.AddTextBox(20+2*spacing,20)
  Controls.SetSize(value,gw-2*spacing-40,25)
  LDShapes.PenColour(value,“White”)
  LDShapes.BrushColour(value,“DimGray”)
  ‘
  tb = Controls.AddMultiLineTextBox(20,60)
  Controls.SetTextBoxText(tb,“Connection status : “+status)
  Controls.SetSize(tb,gw-40,100)
  LDShapes.PenColour(tb,“White”)
  LDShapes.BrushColour(tb,“DimGray”)
EndSub
‘==================================================
‘EVENT SUBROUTINES
‘==================================================
Sub OnDataReceived
  dataIn = Text.Append(dataIn,LDCommPort.RXAll())
  If (Text.IsSubText(dataIn,nl)) Then
    newData = LDText.Trim(dataIn)
    dataIn = “”
  EndIf
EndSub
Sub OnButtonClicked
  button = Controls.LastClickedButton
  If (button = clear) Then
    tbData = “”
  ElseIf (button = send) Then
    val = Controls.GetTextBoxText(value)
    If (val = Math.Round(val)) Then
      tbData = Text.Append(“*** “+val+” sent as integer ***”+nl,Controls.GetTextBoxText(tb))
      val = “i”+val
    ElseIf (val+0 = val) Then
      tbData = Text.Append(“*** “+val+” sent as float ***”+nl,Controls.GetTextBoxText(tb))
      val = “f”+val
    ElseIf (val <> “”) Then
      tbData = Text.Append(“*** “+val+” sent as string ***”+nl,Controls.GetTextBoxText(tb))
      val = “s”+val
    Else
      tbData = Text.Append(“*** Nothing sent ***”+nl,Controls.GetTextBoxText(tb))
    EndIf
    If (val <> “”) Then
      LDCommPort.TXString(val)
    EndIf
  Else
    For i = 1 To nButton
      If (button = buttons[i]) Then
        tbData = Text.Append(“*** Action “+i+” instruction sent ***”+nl,Controls.GetTextBoxText(tb))
        LDCommPort.TXString(i)
      EndIf
    EndFor
  EndIf
  Controls.SetTextBoxText(tb,tbData)
EndSub

Arduino Code

The Arduino code is similar to C++, and there are lots of samples for all sorts of electronic projects out there.  It is compiled and sent to the Arduino using a special Arduino IDE.  My sample below is just testing the serial communication, with no electronics at all.  It could be shorter if you just wanted to send data to Small Basic or only have a couple buttons (code size is quite limited on Arduino), but I wanted to test various data types in the communication.

The Serial.begin(9600)sets the serial communication speed, also set in Small Basic, LDCommPort.OpenPort("COM3",9600).

The Serial.setTimeout(10) prevents partial data from being used, you may need to change this.  If you are reading bytes consider using Serial.available() in a while loop to read all available bytes.

char cInput;
int iInput;
float fInput;
String sInput;

void setup()
{
  Serial.begin(9600);
  Serial.setTimeout(10);
}

void loop()
{
  Input();
  delay(10);
}

void Input()
{
  sInput = Serial.readString();
  cInput = '0';
  if (sInput.length() > 0)
  {
    cInput = sInput.charAt(0);
    switch (cInput)
    {
      case 'i':
        iInput = sInput.substring(1).toInt();
        Serial.println(iInput);
        break;
      case 'f':
        fInput = sInput.substring(1).toFloat();
        Serial.println(fInput);
        break;
      case 's':
        sInput = sInput.substring(1);
        Serial.println(sInput);
        break;
      case '1':
        fInput = 3.14;
        Serial.println(fInput);
        break;
      case '2':
        iInput = random(256);
        Serial.println(iInput);
        break;
      case '3':
        Serial.println("A text result");
        break;
      case '4':
        Serial.print('A');
        Serial.print('B');
        Serial.println('C');
        break;
      default:
        Serial.println("Error");
        break;
    }
  }
}

Enjoy playing with Small Basic and Arduino.


BOOK GIVEAWAY: Win a free copy of our new book, “Learn to Program with Small Basic!”

$
0
0

Hello Small Basic peoples!

I’m proud to announce that I’ve teamed up with Majed Marji, the author of Learn to Program with Scratch. We have a new book coming out in April from No Starch Press:

            

 

No Starch Press is giving away 20 books as prizes!

  • 10 PRIZES: 1 Ebook for 10 randomly chosen survey participants
  • 10 PRIZES: 1 Printed Book for the Top 10 best feedback answers in the survey

 

To get started, take this Small Basic survey:

 

The promotion ends next week, on Friday, 4/01/16. No fooling! =^)

 

The Top 10 best feedback survey results will be selected by the Small Basic team, who is looking for quality insights.

 

Learn to Program with Small Basic brings code to life and introduces you to the empowering world of programming. You’ll master the basics with simple activities like displaying messages and drawing colorful pictures, and work your way up to programming playable games!

The book is written to about a 13-year old audience, but kids can start reading it at a younger age, and adults will find it as a great way to ease into text-based computer programming! It’s designed so that anybody can read it on their own, but it’s packed full of useful problems and challenges to be an asset for teachers and students. That includes the code from all the programs you learn in the book (both incomplete versions, to challenge the students, and the final versions of the code to compare and learn from), as well as both for all the challenges and practice assignments. And it also includes a list of test-like questions and online resources for every chapter as well! And finally, it features a thread of random humor (to keep students on their toes) and some valuable connections into the Small Basic online community engagements.

 

Remember to take the survey to be eligible for the prizes!

Small and Basically yours,

– Ninja Ed

New Oculus Rift Extension for Small Basic – Oculus SB

$
0
0

First of all, this awesome new extension comes from the one and only…

Zock77

Zock77's avatar

Here it is in Zock’s words…

Awhile ago, a friend of mine lent me an Oculus rift. It is a virtual reality headset that can be use for immersive gaming. This is how it works: It tracks your head movement and alters the screen view inside the headset to match the way you are looking. This is cool, but I really wanted to use it in smallbasic, so I went ahead and wrote the OculusSB extension. What is does is return for you the yaw, roll and pitch for the Oculus rift. I have already used it in all sorts of smallbasic applications, and it works great! One of my favorites so far is using it with Litdevs 3d extension. Its pretty cool. Another thing I have done with it is hook it up to a webcam on a servo, and then control the servo with Litdevs waveform extention, so it will match the Oculus’ movements.

What I hope to end up accomplishing is using the oculus to control a camera on a RC aircraft, so it will really feel like you are on top  of the airplane.

The Oculus has two eyepieces, which means you can give the illusion of depth if you make two duplicate objects (one in each eyepiece) and move them closer together and farther apart.

Here is a picture of what the Oculus looks like from the screens point of view:

So by moving the objects closer together, you make your self go further cross-eyed, telling your brain that the object is closer to you. It creates an amazing illusion.

Here is a quick program I wrote that works beautifully with the Oculus.

KRH756

The faster moving balls are closer together, which gives the illusion that they are closer to you.

I figured that other people might want to make use of it, so I’m going to post the extension here:

link

Here is how to use it. First, use OculusSB.PollRift() to update the Yaw, Roll, and Pitch functions. Then you can call OculusSB.GetYaw() (or roll or whatever) to get the desired sensor data.

Thanks guys, and have fun!

BONUS EXTENSION: Maestro Servo Controller

Hey guys! I just got a maestro servo control board and hooked it up to the Oculus with Smallbasic! It works really well!

The control board:

If anyone wants the extension to control the servo board from SB, you can download it here:

 

=====================

Thank you to Zock for these amazing extensions!

 

And remember to stay Small and Basic. The world is complicated enough as it is!

– Ninja Ed

Small Basic New Blog

$
0
0

This blog had following design:

Old Small Basic Blog

But now this blog has following new design:

Small Basic Blog

HTML contents have also changed, so I updated a program introduced in this post.  The new program ID is CPP576-1.  I could easily add publish dates because the new blog has dates of the posts in the list pages.

BlogArticleList06

Next, I’m going to rewrite my another program for User Ed blog.

 

Most Popular Algorithm?

$
0
0

Challenge of the Month – April 2016 has been started.  This month, calculation by hand is picked up as a community suggestions:


Community Suggestions

This month the community suggestions for challenges were posted in separate threads. Thanks for all suggestions.

Post answers here or on the challenge threads linked to below.

  • Create a fully functional calculator (8-digit, basic calculator, not scientific) but do all the calculations by hand…meaning that if the user wants 356 * 8…the program should multiply 8*6 then 8*5+4 then 8*3+4. Just like you would do it if you had to multiply with pencil and paper. This would require addition, subtraction, multiplication and division and as an added challenge, negative numbers.  By jherch77 (ORIGINAL POST).

This thread by jherch77 is that I wrote once in this blog.  Last time I wrote that I love this challenge.  Today, I’d like to write why I love the calculation by hand so much.

I wrote an addition program RHP722.

Addition012

So many people know how to add by hand like this program.  I think how to add by hand is the most popular algorithm.  That is the reason why I love this challenge.

Let’s start programming well known algorithms!  You may be noticed the difference between human and computer by trying this challenge.

Thank you litdev for picking up jherch77’s challenge.

 

 

 

Small Basic at the TEALS CS Fair

$
0
0

On Friday, April 1, 2016 Microsoft’s TEALS program held a Computer Science Fair to 1,600 enthusiastic computer science students and Small Basic was there to talk to the teens and educators who stopped by our booth to learn more about it. We had a demo of a simple program I wrote and let them experience how IntelliSense helps them as they type.

Liz and Ed at the TEALS CS Fair

Liz and Ed at the TEALS CS Fair

Some of the highlights of the day for me included sharing with students how Small Basic helps break down complex problems, with IntelliSense, informative Help Area and online curriculum, all of which can help them even as they learn more complex languages.  Also, because Small Basic is easy to learn and a great next step from Hour of Code, it’s also a great way to reinforce concepts as you learn them by teaching to others, whether to younger siblings, friends or volunteering in the community.  I love encouraging others to pass on their knowledge and seeing that light bulb moment happen when they realize they know someone who would love to learn more!

We also got great questions from the students, like

  • Can you write an operating system in Small Basic? Well, no. But Small Basic, like all programming languages, as Ed says, a tool in your tool belt, and as you “graduate” from Small Basic, you add more and more. It’s a great foundation to start with and work up from.
  • What can you make with Small Basic? I wrote a simple “greeting card” pop up using Flickr to grab a random image and then added text to it, but check out the blog for inspiration! There’s tons of games, you can make an automatic desktop background changer, there’s a new Oculus Rift extension
  • What if I already know Java/C#? I’m teaching myself programming, using Small Basic and have also been following some C# tutorials.  Small Basic narrows the scope down to help me focus, gives me additional help and all the curriculum out there helps with the “why” and not just the “how,” where a lot of others focus on the methodology to get something done.
Viewing all 201 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>