Ball – Ball Collision

Below is a python code written in codeskulptor to test the reflection of a ball when it collides with another ball. Different values can be given to v and v1 to test it if is working in the manner we want to.

from math import *
v = [1, 0]
v1= [0, 0]
angle = pi/4

def update_collision(v,angle):
v1[0]=v[0]*(sin(angle)**2-cos(angle)**2)-2*v[1]*sin(angle)*cos(angle)
v1[1]=-v[1]*(sin(angle)**2-cos(angle)**2)-2*v[0]*sin(angle)*cos(angle)
return v1

print update_collision(v)

DX BALL

This is a game that I made after completing a course on interactive python. The coding was done in codeskulptor.

  • The course helped me to learn how to write code for GUIs.
  • It helped me to understand how powerful classes are in programming.
  • As it had a certain deadline for the projects, I learnt to manage my time better than I usually do.
  • From this program, I learnt how to make a ball reflect of another ball when they collide with each other.
  • Link : http://www.codeskulptor.org/#user40_gYWOngGyxdBfvwS_0.py

game

Python Programming

 Asteroid:

I have taken online course on Coursera’s Interactive python part – 2. This gave me a nice chance to build a mini project called ASTEROID.

http://www.codeskulptor.org/#user40_r7pHUJiTh6cUl0b.py

 

Screenshot from 2015-10-26 08:13:27

 

 

splash11

 

 

Scripting with Python for Arduino

I had to learn on programming the Arduino for producing two square signals that operated in different frequencies and at the same time, had to perform a duty sweep along with a Frequency sweep. The Arduino had a machine level commands of nop; No Operation command, given directly to the required pins. Each nop has a time period of 62.5ns and manually doing each frequency seemed to be a time consuming process. Then scripting the a python code that could take inputs of Frequency and duty cycle and produce a .ino file that the Arduino reads was super efficient, files were created instantly. but i faced another issue my files contained periods in the files name i had to debug cause Arduino does not accept periods in its file names. Following is the script file that i converted into an executable using pyinstaller.

PrintArduinoDuty

Water

Water was our next Source to explore, we had a few hours together on brainstorming of what water is and what do we use it for. Then came the talk about with what does water mix or what gets dissolved in water… the children came with many interesting ideas such as water and oil cant mix,… Then a girl said that is not possible how do we then wash our dishes? on the following day the some of the children brought to school oil and dish soap and detergents.. We had loads of fun trying to mix water and oil and shake shake shake but whatever amount of shake they returned to their original state separated. then a little dish soap and detergent did the magic… 🙂

DSC_0933 DSC_0934

The children concluded that non-liking liquids; water and oil, can be made to like each other with the help of dish soap for some time and this is what happens when they wash their lunch plates clean of oil.

Another Battery Model Using Water…..

The following class a similar battery model was shown and the children figured out on how to connect the rods ( Cu and Zn ) so that electricity could flow from one bottle to another and so on until the terminals reached the led tower, thus building a small battery unit to power the led up. the children found out that the rods should be kept in series manner to achieve the working of the experiment. They also noted that the copper rods colour was fading eventually with time.

DSC_0807 DSC_0808 DSC_0811

 

Building a Battery model

The sixth grade children are super interested when you do something new in class, that’s what happened when we all together build battery models using lemon, copper and zinc rods to produce sufficient electricity to turn on a led 😉 and a digital watch.

DSC_0798DSC_0797

DSC_0794DSC_0796