Team Updates

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class right_grip : MonoBehaviour {
public GameObject grip1;
public float mSpeed1;
private Rigidbody rbody1;
private float input;
private int start_position,outerLimit,innerLimit;
// Use this for initialization
void Start () {
innerLimit = 26;
outerLimit = 0;
start_position = outerLimit;
mSpeed1 = 10f;
//rbody1 = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
//rbody1.AddForce(0f, 0f, 1 * mSpeed1 * Input.GetAxis("Horizontal") * Time.deltaTime);
input = Input.GetAxis("Horizontal");
if (input != 0)
{
if (input > 0)
{
start_position++;
}
else if (input < 0)
{
start_position--;
}
if (start_position >= outerLimit && start_position <= innerLimit)
{
transform.Translate(-1 * Vector3.back * Input.GetAxis("Horizontal") * Time.deltaTime);
}
if (start_position > innerLimit)
{
start_position = innerLimit;
}
else if (start_position < outerLimit)
{
start_position = outerLimit;
}
}
}
}
view raw right_grip.cs hosted with ❤ by GitHub
M
Mohamed Hosny Mohamed Bakr
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class left_grip : MonoBehaviour
{
public GameObject grip1;
public float mSpeed1;
private Rigidbody rbody1;
private int start_position;
private float input;
private int outerLimit, innerLimit;
// Use this for initialization
void Start()
{
innerLimit = 30;
outerLimit = 0;
mSpeed1 = 10f;
start_position = outerLimit;
//rbody1 = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
//rbody1.AddForce(0f, 0f, -1 * mSpeed1 * Input.GetAxis("Horizontal") * Time.deltaTime);
input = Input.GetAxis("Horizontal");
if (input != 0)
{
if (input > 0)
{
start_position++;
}
else if (input < 0)
{
start_position--;
}
if (start_position >= outerLimit && start_position <= innerLimit)
{
transform.Translate(1 * Vector3.back * Input.GetAxis("Horizontal") * Time.deltaTime);
}
if(start_position > innerLimit)
{
start_position = innerLimit;
}else if(start_position < outerLimit)
{
start_position = outerLimit;
}
}
}
}
view raw left_grip.cs hosted with ❤ by GitHub
M
Mohamed Hosny Mohamed Bakr
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class objectCreator : MonoBehaviour {
float mSpeed;
float degree;
float input;
// Use this for initialization
public GameObject cylinder1;
public GameObject grip1,grip2;
void Start () {
mSpeed = 20f;
degree = 90;
}
// Update is called once per frame
void Update () {
//
/*
float z = Input.GetAxis("Horizontal") * 15.0f; // might be negative, just test it
Vector3 euler = transform.localEulerAngles;
euler.z = Mathf.Lerp(euler.z, z, 2.0f * Time.deltaTime);
transform.localEulerAngles = euler;
*/
/*
input = Input.GetAxis("Vertical");
if (input > 0)
{
degree += 20;
}else if(input < 0)
{
degree -= 20;
}
if (degree < 0)
{
degree = 0;
}
else if (degree > 180)
{
degree = 180;
}
*/
transform.RotateAround(cylinder1.transform.position, Vector3.back, -1 *mSpeed * Input.GetAxis("Vertical") * Time.deltaTime);
}
}
M
Mohamed Hosny Mohamed Bakr
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class right_grip : MonoBehaviour {
public GameObject grip1;
public float mSpeed1;
private Rigidbody rbody1;
private float input;
private int start_position,outerLimit,innerLimit;
// Use this for initialization
void Start () {
innerLimit = 26;
outerLimit = 0;
start_position = outerLimit;
mSpeed1 = 10f;
//rbody1 = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
//rbody1.AddForce(0f, 0f, 1 * mSpeed1 * Input.GetAxis("Horizontal") * Time.deltaTime);
input = Input.GetAxis("Horizontal");
if (input != 0)
{
if (input > 0)
{
start_position++;
}
else if (input < 0)
{
start_position--;
}
if (start_position >= outerLimit && start_position <= innerLimit)
{
transform.Translate(-1 * Vector3.back * Input.GetAxis("Horizontal") * Time.deltaTime);
}
if (start_position > innerLimit)
{
start_position = innerLimit;
}
else if (start_position < outerLimit)
{
start_position = outerLimit;
}
}
}
}
view raw right_grip.cs hosted with ❤ by GitHub
M
Mohamed Hosny Mohamed Bakr
#include <Wire.h>
#include <MPU6050.h>
#include <Servo.h>
//---------------------
int Pot = A1;
int value;
//---------------------------
Servo myservo; // create servo object to control a servo
MPU6050 mpu;
float timeStep = 0.01;
float yaw = 0;
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(9600);
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
// Calibrate gyroscope. The calibration must be at rest.
// If you don't want calibrate, comment this line.
mpu.calibrateGyro();
// Set threshold sensivty. Default 3.
// If you don't want use threshold, comment this line or set 0.
mpu.setThreshold(5);
// pinMode(A0 , INPUT);
}
int hamoksha=0;
void loop()
{
Vector norm = mpu.readNormalizeGyro();
yaw = yaw + norm.ZAxis *timeStep;
hamoksha=map(yaw,-80,80,0,180);
hamoksha=constrain(hamoksha,0,180);
myservo.write(hamoksha);
//----------------------------------
value = analogRead(Pot);
value=map(value,0,1023,0,255);
//---------------------------
Serial.write('a');
delay(100);
Serial.write(value);
Serial.write('a');
delay(100);
Serial.write(hamoksha);
}
view raw master.ino hosted with ❤ by GitHub
M
Mohamed Hosny Mohamed Bakr
Team Stream Item
M
Mohamed Hosny Mohamed Bakr
the second circuit
the second circuit
m
mohammed nabiel
our designed circuits
our designed circuits
m
mohammed nabiel
NASA Logo

SpaceApps is a NASA incubator innovation program.